Tuesday, January 26, 2016

Qlikview-Interview-Questions


Thanks To "intellipaat" for getting this wonderful collection through LinkedIn.
Original Post : 
https://intellipaat.com/interview-question/qlikview-interview-questions/?utm_source=link%2FqlikviewIQ_AS&utm_medium=posting&utm_campaign=link%2FqlikviewIQ_AS%20posting

1.What kind of chart we use in Qlikview?
We generally uses bar chart, line chart, combo chart, scatter chart, grid chart, etc.
2.Explain Set analysis in qlikview ??
It is used for set of groups. Mostly used in arrgeted function like sum (year)etc.
3.Define Trellis chart?
In Trellis chart we can create array of chart based on first dimension. Bitmap chart are also made of trellis display.
4Explain Mini Chart?.What do you mean by sub reports and how we can create them?
With the help of Mini Chart we can set type of modes instead of values in table mode. We can also change the colors.
5.What is Pivot Table?
Pivot Table:
A pivot table is better at the time of grouping. We can also show pivot table like a cross table which is a beneficial feature. But there is one disadvantage of it which is if we have to sort a pivot table than we have to sort it first according to the first dimension then to the next.
6.Which graph we will use for two years difference sale ?
BAR Graph we will use.
7.What is Straight Table?
A straight table is much better at the time of sorting as compared to the pivot table as we can sort it according to any column as per our choice. But it is not good for grouping purpose.
8.How many dimensions we can use in Bar chart?
We can use only two dimension
9.Which Qlikview object has only expression and no dimension?
Gauge chart and list box have only expression and no dimension.
10.How we can use Macros in our application?
We can use macros for various purposes like for reloading the application and to create a object.
11.What do you understand by layers in Qlikview?
The layer are basically set on the sheet object properties layout where bottom, top, normal respective to the number -1,0 and 1.
12.What is Dimensions?
Dimensions allow data examination from various perspectives.
13.Explain about Normalized Data?
Well Structured Form of Data, which doesnt have any repetition or redundancy of data. Its a kind of Relational data. Its mainly used in OLTP kind of stuffs Denormalized Data – Its a whole bunch of data without any relationship among themselves, with redundancy of data. Its mainly used in OLAP kind of stuffs.
14.What Is Star Sechma ?
The simplest form of dimensional model, in which data is prearranged into facts and dimensions is known as Star schema.
15.What is Snowflaking Schema ?
A snowflake schema is a difference of the star schema. Snowflaking is used to improve the presentation of particular queries.
16.Explain interval match?
The internal match is prefixes with the load statement which is used for connecting different numeric values to one or more numeric interval.
17.Explain internal match function()?
Internal match fuction is used to generate data bucket of different sizes.
18.What is Container ?
A container object is used to keep multiple charts. We can use a container object to keep many charts in the same box.
19.What do you understand by extended interval match function()?
Extended interval match function() is used for slowly changing the dimensions.
20.what are the new features in QV 11?
Container Object;Granular Chart Dimension Control; Actions like, clear filed; meta data,etc are the new features in QV 11.
21.Explain joins and its types?
Join is used to convert the given data and whenever we are using joins for converting data its is known ad Data Merging.
It has many types:
a. Left join
b. Right join
c. Inner join, etc
22.What is Left Join?
Left join specifies that the join between the two tables should be left join, it uses before the word join. The resulting table only contain the combination among two tables with the full data set from the first table.
23.Define right join?
Right join specifies that the join between the two tables should be right join, it uses before the word join. The resulting table only contain the combination among two tables with the full data set from the second table.
24.Explain Inner Join?
Inner join specifies that the join between the two tables should be inner join. The resulting table should contain the full data set from both the sides.
25.What are modifiers?
Modifiesr deals with the Fields name.
For example: sum({$}Sales)
Returns the sales for current selection, but with the selection in “Region” is removed.
26.Explain Identifiers Syntax?
1. 0- Represents the empty set
2. 1- Represents the full sets of records
3. $-Represents the record of current selection
4. $1-Represents the previous selection
5. $_1-Represents the next selection
6. Bookmark01-Represents the Bookmark name
27.Explain 3-tier architecture of Qlikview Application?
1-tier: Raw data is loaded and we create QVD
2-tier: QVD is converted in business login and the requirement of business and data model is created.
3-tier: Reading all QVD from 2-tier and we make a single QVW.
28.How does Qlikview stores the data internally?
Qlikview stores the data in QVD as QVD has data compression capability. Qlikview has better performance than other BI because of its memory analytics approach.
29.Explain the restrictions of Binary load?
Binary Load can be used for only one application means we can only read the data from one QVW application and moreover set scripts is also a restriction.
30.Differentiate betwwen subset Ratio and Information Density.
Subset Ratio: It is used for easily spot problem in key field association.it is only relevant for key fields since they are present in multiple tables and do not share the same value.
Information Density: It is the field which contain the percentage of row which contain the non-null value.
31.what is the use of Optimized Load?
Optimized load is much faster and preferable especially for large set of data. It is possible if n o transformation are made at the time of load and no filtering is done.
32.Differentiate between keep and joins?
Keep and joins do the same functions but in keep creates the two tables whereas join only creates the one table. Keep is used before the load or select statements.
33.Define synthetic Key?
Synthetic key is the key where two or more tables consists more than one common column between them is called as synthetic key.
34.What is incremental load in Qlikview?
Incremental load is nothing but loading new or changed records from the database. With the help of QVD files we can use incremental Load.
35. Differentiate between set and let option in Qlikview??
Set: it assigns the variable without assesses the expression.
Let: it assigns the variable with assesses the expression.
36.Define Qlikview Resident Load.
Resident load is a part of loading data in Qlikview application. It is used for loading data in tables which is already loaded in Qlikview application.
37.How we can optimize QV application?
It can be optimized by creating the data into qvds. When complete qvw application is changed into qvd than this qvd will be store in the RAM.
38.What is mapping load?
Mapping load is used to create the mapping table that can be used for replacing field value and field names.
39.Define apply map.
apply map is used to add fields to the tables with the help of other tables. It can be used as joins.
40.What is concatenation?
It means sequence of interconnected things i.e. any column or row which is related to each other can be connected through concatenation.
41.Define NoConcatenation.
NoConcatenation prefix is used to forced the identical tables as two separate internal tables.
42.Define connect statement.
It is used to establish a connection the connection to database with the help of ODBC or OLEDB interface.
43.What do you understand by Fact constellation Schema?
It is a logical database structure of data Warehouse . It is design with the help of De Normalized Fact..
44.What do you mean by RDBMS?
It stands for relational Database management System. It arrange the data into respective column and rows.
45What do you understand by the term CAL in Qlikview?
Every client need a CAL to get connected with Qlikview Server. The CALS are taken up with Qlikview Server and tied with the server serial number.
46.Differentiate between QV server and publisher?
QV Server is a program that is installed on computer with various CALS which allow user to access QV Files on the server. Publisher is a program which manages centralized control on our QV files and manages them how and when the are loaded and distributed.
47.What do you understand by snapshot view of the table?
By this option we can see number o tables and related associations.
48.How we can bring data into qv?
We use ODBC, OLEDB, SAP connectors kind of data connections.
49.How we can handle Early Arriving Facts.
We can load data from ODBC, OLEDB, SAP connectors , by select statements and we can also load files like excel, word, etc. by using Table Syntax.
50.What type of data we generally use?
We use flat files, excels, QVDs, etc ad data.
51. Explain about QlikView?
QlikView is the Business Intelligence tool used by the University of St Andrews. Data from different University systems is combined and presented in a single dashboard in an easy and understandable way.
QlikView dashboards at the University of St Andrews are built on the following principles:
• Dashboards must be effective to use
• Dashboards must support users in carrying out their tasks
• Dashboards must provide the right kind of functionality
• It must be easy to learn how to use a dashboard
• It must be easy to remember how to use a dashboard
• To use QlikView, you do not need to have technical expertise in information systems, just a willingness to learn how it can support you.
52. What are the benefits of using QlikView?
As the name suggests, QlikView is a combination of quick and click and these features make it intuitive and easy to use. Users can visualize data, search multiple data sets, create ad hoc reports, and view patterns and trends in data that may not have been visible in other reports.
QlikView is
• Flexible – dashboards are web based and accessible from desktop computers and mobile devices
• Interactive – users are able to drill down and select particular data within charts or tables
• Usable – users can see large amounts of data effectively and efficiently
• Scalable – useful for multiple business processes at analytical, operational and strategic levels
53. How is QlikView 11 different from QlikView 10?
QlikView 11 brings new levels of capability and manageability to the QlikView Business Discovery platform. In this release, we focused our investments on five value propositions:
• Improve collaborative decision making with Social Business Discovery
• Gain new insights into opportunities and threats and relative business performance with comparative analysis
• Expand QlikView usage to additional devices, including smartphones, with mobile Business Discovery
• Enable a broad spectrum of users to jointly develop QlikView apps with QlikView’s rapid analytic app platform capabilities
• Improve the manageability and performance of QlikView with new enterprise platform capabilities.
54. What is QlikView comparative analysis?
Business users can quickly gain new kinds of insight when analyzing information in QlikView, with new comparative analysis options. App developers can now create multiple selection states in a QlikView app; they can create graphs, tables, or sheets based on different selection sets.
55. What mobile device platforms does QlikView 11 support?
QlikView 11 delivers mobile functionality for Apple iOS and Android tablets and smartphones. QlikView supports Android tablets when the following conditions are met:
• QlikView Server version 10 SR3 or later
• The native browser, not a downloaded one
• Currently our HTML5 web apps support only Apple and Android handhelds. Because many Black Berry are older devices that don’t fully support HTML5 (and many are non-touch), we don’t have a web-based solution for them at this time.
56. What is document-level auditing in QlikView 11?
New optional settings within QlikView Management Console enable administrators to more effectively audit user interactions. Administrators can audit QlikView usage not only at the system level (the entire QlikView Server), but down to the document level.
57. What are the key differences between QlikView and any other standard statistical software package (SAS, SPSS)?
Key difference is in terms of the database used. QlikView offers a quite simple visualization that matches the MS excel filtering. SAS is useful in case of Meta data while SPSS is good for analysis.
In comparison of the above three, QlikView is most user friendly and fast in terms of generating diverse dashboards/templates.
In terms of calculations, advanced statistics options are limited in QlikView.
For market research and analysis SPSS has direct facility algorithms.
58. What are QlikView annotations?
With the new annotations collaboration object QlikView users can engage in threaded discussions about QlikView content. A user can create notes associated with any QlikView object. Other users can then add their own commentary to create a threaded discussion. Users can capture snapshots of their selections and include them in the discussion so others can get back to the same place in the analysis when reviewing notes and comments. QlikView captures the state of the object (current selections), as well as who made each note and comment and when, for a lasting record of how a decision was made.
59. What are the main features of QlikView?
QlikView offers the following features:
• Dynamic BI Ecosystem
• Data visualization
• Interacting with dynamic apps, dashboards and analytics
• Searching across all data
• Secure, real-time collaboration
60. What are the differences among QlikView Server editions?
The differences are:
QlikView Server Enterprise Edition (EE) is available for customers looking to support a large number of users and integrate into enterprise environments. It includes features such as:
• Unlimited documents
• Integration with third party security systems
• Server clustering
• Small Business Edition (SBE) is designed to be used in smaller deployments.
It has the following limitations:
• For use only with Named and Document CALs
• Limited to 25 Named User CALs
• Limited to 100 Document CALs
• No support for additional servers
• Only supports Windows Active Directory to handle security and access control
Information Access Server (IAS) is an edition of QlikView Server designed to power public Internet sites. This edition:
• Includes the add-on QlikView Real Time Server
• Is licensed for uncapped number of user but limited to one QlikView document
• Must be set to anonymous mode only and authentication must be off
• Requires that the QlikView server be on the public Internet and publicly accessible
• Requires that the URL for accessing the site powered by the QlikView Server be publicly accessible
• Requires that no QlikView client (e.g., QlikView Desktop, Internet Explorer plug-in, Ajax) can access the QlikView Server (all user interfaces must be built by the customer manually or with QlikView Workbench)
QlikView Extranet Server (QES) is an edition of QlikView Server designed to extend QlikView functionality to external users via an extranet. QES:
• Requires authentication. Users must be external to the purchasing organization (customers, partners, etc.).
• Restricts server access to the Ajax client and mobile clients
• Provides the option to customize the QlikView application via the included QlikView Workbench
• Supports a maximum of 3 QlikView documents
• Supports session CALs and usage CALs only


Tuesday, December 1, 2015

Macro - Extract Email data into Excel

Thanks to "David Lee" : http://en.gravatar.com/technotion.

Copied & Customized from:
https://techniclee.wordpress.com/2011/10/29/exporting-outlook-messages-to-excel/

Customized Ajay - Version :

Const MACRO_NAME = "Export Messages to Excel (Rev 5)"
Const EXPORT_FOLDER = "C:\Outlook\Macro_Email_Export\EXPORT_FOLDER\"
    Dim excApp As Object, _
        excWkb As Object, _
        excWks As Object, _
        intVersion As Integer, _
        strFilename As String, _
        intMessages As Integer, _
        strAtt As String

Sub ExportMessagesToExcel()
  On Error Resume Next
    'strFilename = InputBox("Enter a filename (including path) to save the exported messages to.", MACRO_NAME)
    strFilename = "C:\Outlook\Macro_Email_Export\Export_" & Format$(Now, "yyyymmdd-hhnn")
    If strFilename <> "" Then
        intMessages = 0
        intVersion = GetOutlookVersion()
        Set excApp = CreateObject("Excel.Application")
        Set excWkb = excApp.Workbooks.Add()
        Set excWks = excWkb.ActiveSheet
        'Write Excel Column Headers
        With excWks
            .Cells(1, 1) = "Folder"
            .Cells(1, 2) = "Subject"
            .Cells(1, 3) = "Received"
            .Cells(1, 4) = "Sender"
            .Cells(1, 5) = "To"
            .Cells(1, 6) = "Attachments"
            .Cells(1, 7) = "Body"
        End With
        ProcessFolder Application.ActiveExplorer.CurrentFolder
        excApp.DisplayAlerts = False 'RESETS DISPLAY ALERTS
        excWkb.SaveAs strFilename
        excWkb.Close
        excApp.DisplayAlerts = True 'RESETS DISPLAY ALERTS
    End If
    Set excWks = Nothing
    Set excWkb = Nothing
    Set excApp = Nothing
    'MsgBox "Process complete.  A total of " & intMessages & " messages were exported.", vbInformation + vbOKOnly, MACRO_NAME
End Sub
 Sub ProcessFolder(olkFld As Outlook.MAPIFolder)
    Dim olkMsg As Object, olkSub As Outlook.MAPIFolder, intRow As Integer
    Dim olkAtt As Outlook.Attachment
    intRow = excWks.UsedRange.Rows.Count
    intRow = intRow + 1
    'Write messages to spreadsheet
    For Each olkMsg In olkFld.Items
            If olkMsg.Class = olMail Then
                'Add a row for each field in the message you want to export
                excWks.Cells(intRow, 1) = olkFld.Name
                excWks.Cells(intRow, 2) = olkMsg.Subject
                excWks.Cells(intRow, 3) = olkMsg.ReceivedTime
                excWks.Cells(intRow, 4) = GetSMTPAddress(olkMsg, intVersion)
                excWks.Cells(intRow, 5) = olkMsg.To
                strAtt = ""
                For Each olkAtt In olkMsg.Attachments
                    If Not IsHiddenAttachment(olkAtt) Then
                        strAtt = strAtt & olkAtt.FileName & ", "
                        olkAtt.SaveAsFile EXPORT_FOLDER & Format$(olkMsg.ReceivedTime, "yyyymmdd-hhnn") & olkAtt.FileName
                    End If
                Next
                If strAtt <> "" Then
                    strAtt = Left(strAtt, Len(strAtt) - 2)
                End If
                excWks.Cells(intRow, 6) = strAtt
                excWks.Cells(intRow, 7) = olkMsg.Body
                intRow = intRow + 1
                intMessages = intMessages + 1
            End If
    Next
    Set olkMsg = Nothing
    For Each olkSub In olkFld.Folders
        ProcessFolder olkSub
    Next
    Set olkssub = Nothing
End Sub

Private Function GetSMTPAddress(Item As Outlook.MailItem, intOutlookVersion As Integer) As String
    Dim olkSnd As Outlook.AddressEntry, olkEnt As Object
    On Error Resume Next
    Select Case intOutlookVersion
        Case Is < 14
            If Item.SenderEmailType = "EX" Then
                GetSMTPAddress = SMTP2007(Item)
            Else
                GetSMTPAddress = Item.SenderEmailAddress
            End If
        Case Else
            Set olkSnd = Item.Sender
            If olkSnd.AddressEntryUserType = olExchangeUserAddressEntry Then
                Set olkEnt = olkSnd.GetExchangeUser
                GetSMTPAddress = olkEnt.PrimarySmtpAddress
            Else
                GetSMTPAddress = Item.SenderEmailAddress
            End If
    End Select
    On Error GoTo 0
    Set olkPrp = Nothing
    Set olkSnd = Nothing
    Set olkEnt = Nothing
End Function

Function GetOutlookVersion() As Integer
    Dim arrVer As Variant
    arrVer = Split(Outlook.Version, ".")
    GetOutlookVersion = arrVer(0)
   
End Function

Function SMTP2007(olkMsg As Outlook.MailItem) As String
    Dim olkPA As Outlook.PropertyAccessor
    On Error Resume Next
    Set olkPA = olkMsg.PropertyAccessor
    SMTP2007 = olkPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5D01001E")
    On Error GoTo 0
    Set olkPA = Nothing
End Function

Function IsHiddenAttachment(olkAtt As Outlook.Attachment) As Boolean
    Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
    Dim olkPA As Outlook.PropertyAccessor, varTemp As Variant
    On Error Resume Next
    Set olkPA = olkAtt.PropertyAccessor
    varTemp = olkPA.GetProperty(PR_ATTACH_CONTENT_ID)
    IsHiddenAttachment = (varTemp <> "")
    On Error GoTo 0
    Set olkPA = Nothing
End Function



Thursday, August 27, 2015

Macro - Extract AD Information into Excel


MACRO :

Simple Macro to Extract Ad Information into Excel

Thanks for the Original Posts by kirrilian:
http://www.visualbasicscript.com/Export-Active-Directory-Users-to-Excel-Worksheet-m29830.aspx

------------------------------------------------------------------------------------------------------------------------
Dim ObjWb
 Dim ObjExcel
 Dim x, zz
 Set objRoot = GetObject("LDAP://RootDSE")
 strDNC = objRoot.Get("DefaultNamingContext")
 Set objDomain = GetObject("LDAP://" & strDNC) ' Bind to the top of the Domain using LDAP using ROotDSE
 Call ExcelSetup("Sheet1") ' Sub to make Excel Document
 x = 1
 Call enummembers(objDomain)
 Sub enumMembers(objDomain)
     On Error Resume Next
     Dim Secondary(20) ' Variable to store the Array of 2ndary email alias's
     For Each objMember In objDomain ' go through the collection    
         If ObjMember.Class = "user" Then ' if not User object, move on.
             x = x +1 ' counter used to increment the cells in Excel
           
               objwb.Cells(x, 1).Value = objMember.Class
               ' I set AD properties to variables so if needed you could do Null checks or add if/then's to this code
               ' this was done so the script could be modified easier.
             SamAccountName = ObjMember.samAccountName
             Cn = ObjMember.CN
             FirstName = objMember.GivenName
             LastName = objMember.sn
             initials = objMember.initials
             Descrip = objMember.description
             Office = objMember.physicalDeliveryOfficeName
             Telephone = objMember.telephonenumber
             EmailAddr = objMember.mail
             WebPage = objMember.wwwHomePage
             Addr1 = objMember.streetAddress
             City = objMember.l
             State = objMember.st
             ZipCode = objMember.postalCode
             Title = ObjMember.Title
             Department = objMember.Department
             Company = objMember.Company
             Manager = ObjMember.Manager
             Profile = objMember.profilePath
             LoginScript = objMember.scriptpath
             HomeDirectory = ObjMember.HomeDirectory
             HomeDrive = ObjMember.homeDrive
             AdsPath = Objmember.Adspath
             LastLogin = objMember.LastLogin
           
             zz = 1 ' Counter for array of 2ndary email addresses
             For Each email in ObjMember.proxyAddresses
                If Left (email,5) = "SMTP:" Then
             Primary = Mid (email,6) ' if SMTP is all caps, then it's the Primary
                Elseif Left (email,5) = "smtp:" Then
                   Secondary(zz) = Mid (email,6) ' load the list of 2ndary SMTP emails into Array.
                   zz = zz + 1
                End If
             Next
             ' Write the values to Excel, using the X counter to increment the rows.
           
             objwb.Cells(x, 2).Value = SamAccountName
             objwb.Cells(x, 3).Value = CN
             objwb.Cells(x, 4).Value = FirstName
             objwb.Cells(x, 5).Value = LastName
             objwb.Cells(x, 6).Value = Initials
             objwb.Cells(x, 7).Value = Descrip
             objwb.Cells(x, 8).Value = Office
             objwb.Cells(x, 9).Value = Telephone
             objwb.Cells(x, 10).Value = EmailAddr
             objwb.Cells(x, 11).Value = WebPage
             objwb.Cells(x, 12).Value = Addr1
             objwb.Cells(x, 13).Value = City
             objwb.Cells(x, 14).Value = State
             objwb.Cells(x, 15).Value = ZipCode
             objwb.Cells(x, 16).Value = Title
             objwb.Cells(x, 17).Value = Department
             objwb.Cells(x, 18).Value = Company
             objwb.Cells(x, 19).Value = Manager
             objwb.Cells(x, 20).Value = Profile
             objwb.Cells(x, 21).Value = LoginScript
             objwb.Cells(x, 22).Value = HomeDirectory
             objwb.Cells(x, 23).Value = HomeDrive
             objwb.Cells(x, 24).Value = Adspath
             objwb.Cells(x, 25).Value = LastLogin
             objwb.Cells(x,26).Value = Primary
           
             ' Write out the Array for the 2ndary email addresses.
             For ll = 1 To 20
                 objwb.Cells(x,26+ll).Value = Secondary(ll)
             Next
             ' Blank out Variables in case the next object doesn't have a value for the property
             SamAccountName = "-"
             Cn = "-"
             FirstName = "-"
             LastName = "-"
             initials = "-"
             Descrip = "-"
             Office = "-"
             Telephone = "-"
             EmailAddr = "-"
             WebPage = "-"
             Addr1 = "-"
             City = "-"
             State = "-"
             ZipCode = "-"
             Title = "-"
             Department = "-"
             Company = "-"
             Manager = "-"
             Profile = "-"
             LoginScript = "-"
             HomeDirectory = "-"
             HomeDrive = "-"
             Primary = "-"
             For ll = 1 To 20
                 Secondary(ll) = ""
             Next
         End If
             
               ' If the AD enumeration runs into an OU object, call the Sub again to itinerate
             
         If objMember.Class = "organizationalUnit" or OBjMember.Class = "container" Then
             enumMembers (objMember)
         End If
     Next
 End Sub
 Sub ExcelSetup(shtName) ' This sub creates an Excel worksheet and adds Column heads to the 1st row
     Set ObjExcel = CreateObject("Excel.Application")
     Set objwb = objExcel.Workbooks.Add
     Set objwb = objExcel.ActiveWorkbook.Worksheets(shtName)
     Objwb.Name = "Active Directory Users" ' name the sheet
     objwb.Activate
     ObjExcel.Visible = True
     objwb.Cells(1, 2).Value = "SamAccountName"
     objwb.Cells(1, 3).Value = "CN"
     objwb.Cells(1, 4).Value = "FirstName"
     objwb.Cells(1, 5).Value = "LastName"
     objwb.Cells(1, 6).Value = "Initials"
     objwb.Cells(1, 7).Value = "Description"
     objwb.Cells(1, 8).Value = "Office"
     objwb.Cells(1, 9).Value = "Telephone"
     objwb.Cells(1, 10).Value = "Email"
     objwb.Cells(1, 11).Value = "WebPage"
     objwb.Cells(1, 12).Value = "Addr1"
     objwb.Cells(1, 13).Value = "City"
     objwb.Cells(1, 14).Value = "State"
     objwb.Cells(1, 15).Value = "ZipCode"
     objwb.Cells(1, 16).Value = "Title"
     objwb.Cells(1, 17).Value = "Department"
     objwb.Cells(1, 18).Value = "Company"
     objwb.Cells(1, 19).Value = "Manager"
     objwb.Cells(1, 20).Value = "Profile"
     objwb.Cells(1, 21).Value = "LoginScript"
     objwb.Cells(1, 22).Value = "HomeDirectory"
     objwb.Cells(1, 23).Value = "HomeDrive"
     objwb.Cells(1, 24).Value = "Adspath"
     objwb.Cells(1, 25).Value = "LastLogin"
     objwb.Cells(1, 26).Value = "Primary SMTP"
     'formatting for header
     Set objRange = objExcel.Range("A1","Z1")
     objRange.Interior.ColorIndex = 33
     objRange.Font.Bold = True
     objRange.Font.Underline = True
 End Sub
 'autofit the output
 Set objRange = objwb.UsedRange
 objRange.EntireColumn.Autofit()
 ObjExcel.Save("ADoutput.xls")
 MsgBox "Done" ' show that script is complete

Friday, May 22, 2015

QV - MACRO - Something Used In Past !!!

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 1. QVServer - Restart
////////////////////////////////////////////////////// QVServer - Restart //////////////////////////////////////////////////////////
'Stopping the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Stop.bat
REM - Description: Stop all QlikView related services (v11)
REM -------------------------------------------------------
echo Stop QlikView Services
echo ======================================================

net stop "QlikView Server"
net stop "Qlikview Directory Service Connector"
net stop "QlikView Distribution Service"
net stop "QlikView Management Service"
net stop "QlikView WebServer"

echo ======================================================

'Starting the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Start.bat
REM - Description: Start all QlikView related services (v11)
REM -------------------------------------------------------
echo Start QlikView Services
echo ======================================================

net start "Qlikview Directory Service Connector"
net start "QlikView Distribution Service"
net start "QlikView Management Service"
net start "QlikView Server"
net start "QlikView WebServer"

echo ======================================================
taskkill /F /IM qv.exe

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 2. Post Reload - export Data into XLS
//////////////////////////////////////////////////LOOPING YEAR MONTH /////////////////////////////////////////////////////
Sub ExportQVD()
      ActiveDocument.Fields("YearMonth").Clear
      set val=ActiveDocument.Fields("YearMonth").GetPossibleValues(1000)
      for i=0 to val.Count-1
          ActiveDocument.Fields("YearMonth").Select val.Item(i).Text
          'msgbox(val.Item(i).Text)
          set obj = ActiveDocument.GetSheetObject("CH02")
          filePath = "D:\Database\leave\leave_" & val.Item(i).Text & ".xls"
          obj.Export filePath,";"
          Set obj = Nothing
       next
End Sub

//////////////////////////////////////////////LOOPING BY YEAR BY MONTH ///////////////////////////////////////////////
Sub ExportQVD_01()
      ActiveDocument.Fields("FinancialYear").Clear
      set val=ActiveDocument.Fields("FinancialYear").GetPossibleValues(1000)
      for i=0 to val.Count-1
      ActiveDocument.Fields("FinancialYear").Select val.Item(i).Text
      set valj=ActiveDocument.Fields("Month").GetPossibleValues(1000)
      for j=0 to valj.Count-1
          ActiveDocument.Fields("Month").Select valj.Item(j).Text 
          set valk=ActiveDocument.Fields("MonthName").GetPossibleValues(1000)       
          'msgbox(val.Item(i).Text)
       
          set obj = ActiveDocument.GetSheetObject("CHRP01")
          filePath = "D:\QlikView App - Phase2\Data\QVD\FIN_EXPORT\FIN_EXPORT_01_" &valk.Item(0).Text & ".xls"
          obj.Export filePath,";"
          Set obj = Nothing


          set obj = ActiveDocument.GetSheetObject("CHRP02")
          filePath = "D:\QlikView App - Phase2\Data\QVD\FIN_EXPORT\FIN_EXPORT_02_"  &valk.Item(0).Text & ".txt"
          obj.Export filePath,";"
          Set obj = Nothing
         
         next
         ActiveDocument.Fields("Month").Clear 
         ActiveDocument.Fields("MonthName").Clear
       next
        ActiveDocument.Fields("FinancialYear").Clear
        ActiveDocument.Save
End Sub

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 3. LOOPING Reduce Macro
//////////////////////////////////////////////LOOPING Reduce Macro///////////////////////////////////////////////////////////////
1. Batch ( To trigger Reload / Distribute )
"c:\Program Files\QlikView\Qv.exe" /vA_IP=200 "D:\Qlikview App\AccessPoint_Display\FIS_Dashboard_Display_v3.qvw"

"c:\Program Files\QlikView\Qv.exe" /vA_IP=201 "D:\Qlikview App\AccessPoint_Display\FIS_Dashboard_Display_v3.qvw"

2. Edit Script
On Open Macro : Call vReduce

3. Macro
Sub vReduce
SIP=getQVVariableAsString("A_IP")

if(SIP>"1") THEN
ActiveDocument.DoReload 0
ActiveDocument.ClearAll

set fldIP= ActiveDocument.getField("IP")
fldIP.Select SIP

ActiveDocument.ReduceData
ActiveDocument.GetVariable("A_IP").SetContent "0", false
ActiveDocument.SaveAs "D:\Qlikview App\AccessPoint_Display\3 Thales_FIS_Dashboard_Display_"&SIP&".qvw"
ActiveDocument.GetApplication.Quit 0

End If

End Sub

Function getQVVariableAsString(aQVVarName)
  set v = ActiveDocument.Variables(aQVVarName)
  getQVVariableAsString = v.GetContent.String
End Function

4. Batch Open ( Distributed files )
taskkill /F /IM qv.exe
taskkill /F /IM IEXPLORE.exe
start /max qv "\\10.77.1.55\QlikView App\Access Point_WIP\3 Dashboard - Display_WIP_40.qvw"

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 4. Cleaning Windows Temp Files
/////////////////////////////////////////////Cleaning Windows Temp Files////////////////////////////////////////////////////////
@echo on 
cd %homedrive%%homepath% 
del /s/f/q locals~1\tempor~1 
del /s/f/q locals~1\temp\tempor~1 
del /s/f/q cookies 
del /s/f/q temp\cookies 
del /s/f/q locals~1\historique 
del /s/f/q locals~1\temp\historique 
del /s/f/q c:\windows\prefetch
del /s/f/q recent 
del /s/f/q %temp%  
md recent 
del /s/f/q locals~1\temp 
del /s/f/q C:\Users\ACHIEVER\AppData\Roaming\Microsoft\Windows\Recent\%
del /s/f/q C:\Users\ACHIEVER\AppData\Roaming\Microsoft\Office\Recent\%

md locals~1\temp

Wednesday, April 8, 2015

Storing QlikView Table to CSV - ANSI encoding instead of UTF8 encoding

Thanks to the Community Posts : Created by Clever Anjos 
https://community.qlik.com/docs/DOC-3712

Community Extract:
As we know QlikView stores text files only in UTF8 encoding.
For example
STORE MyTable to Export.csv(txt);
will save Export.csv as a UTF8 file.
If you need a file in ANSI encoding, QlikView does not provide an option to save it.

So I did this tiny program to convert the output of QlikView into ANSI

Example of use of it inside a QlikView Script:

STORE MyTable to Export.tmp(txt);
EXECUTE utf8_to_ansi.exe  Export.tmp Export.csv;

------------------------------------------------------------------------------------------------------------------------------------------------------------ 

It really a Good Posts !!!