Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
janardhan
Creator
Creator

filtering through Macro

Hi Friends ,

In my application i am using macro to create csv files.But some filtering is there , i need to create filtered data to csv files.

for eg.,

AccountNum
Name
Location
0xxxxchennai
0yyyhyderabad
1111abcdbangalore
1112efghmumbai
1113ijklpune
1114mnopkerala
0rstvumysore
-wxyzamerica

my filtering is based on Accountnum

my expression is if(Accountnum >0 , Accountnum) , i need to create the filtered data as csv files

i am using the macro like this:

Can u pls tell me where should i modify

SUB AdHocExport

confirmation = MSGBOX ("Ad hoc CSV export has been initiated." & vbCrLf & "Do you wish to continue?"& vbCrLf &"",  36, "Export Confirmation")

        IF confirmation = 7 THEN

            EXIT SUB

        END IF

INT FileName

INT var

INT fname

SET f= ActiveDocument.Variables("vfname")

    fname = f.GetContent.STRING

SET v = ActiveDocument.Variables("vMacroChartId")

    var = v.GetContent.STRING

    ActiveDocument.Fields(fname).Clear

SET Doc = ActiveDocument

SET Field = Doc.Fields(accnum).GetPossibleValues

FOR i=0 to Field.Count-1

    Doc.Fields(fname).Clear

    Doc.FIelds(fname).SELECT Field.Item(i).Text

    Doc.GetApplication.WaitForIdle

    FileName = Field.Item(i).Text & ".csv"

          Doc.GetSheetObject(var).Export FileName, ","

NEXT

Doc.Fields(fname).Clear

MSGBOX "Ad hoc CSV export is complete!",64,"Task Completion Notification"

END SUB

Thanks in Advance

0 Replies