Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

add selected value to filename

hi,

i'm trying to make file save with variable name - date and field name.

i have succeeded to get date into file name .

tabe "Daily_days"  has selection 20, and msgbox for double check returns value 20.

but i lack of knowlegge how to input this into file name

so now i get 2016222-20.pdf   the date today 2016.02.22  and manually 20 ...

how to express in the code var_name = value from Daily_days table  selected ? (it's always 1 number selected in that table)

SUB save

SET id= ActiveDocument.Fields("Daily_days")

SET selection = id.GetSelectedValues 

msgbox(selection(i).Text)  'returns now value 20, because day 20 is selected

vReport="RP03"

vX= Year(now())& month(now())& day(now())

var_name="-20"

printReportPDF "D:\Autoreports\QV_Daily_Sales_SQL\" & vX & var_name & ".pdf"

ActiveDocument.GetApplication.Sleep 2000

ActiveDocument.PrintReport (vReport), "QlikViewPDF"

ActiveDocument.GetApplication.Sleep 10000

END SUB

thank you !

5 Replies
sathishkumar_go
Partner - Specialist
Partner - Specialist

set var_name = selection(i).GetContent.String

-Sathish

Not applicable
Author

thanks, but it does not work, it stops in the middle

SUB save

SET id= ActiveDocument.Fields("Daily_days")

SET selection = id.GetSelectedValues 

msgbox(selection(i).Text)  'returns now value 20, because day 20 is selected

vReport="RP03"

vX= Year(now())& month(now())& day(now())

set var_name = selection(i).GetContent.string

printReportPDF "D:\Autoreports\QV_Daily_Sales_SQL\" & vX & var_name & ".pdf"

ActiveDocument.GetApplication.Sleep 2000

ActiveDocument.PrintReport (vReport), "QlikViewPDF"

ActiveDocument.GetApplication.Sleep 10000

  END SUB

sathishkumar_go
Partner - Specialist
Partner - Specialist

what is the error message?

Post your application. its very easy

-Sathish

jonathandienst
Partner - Champion III
Partner - Champion III

set var_name = selection(i).GetContent.string

That should not have a set statement, the RHS expression does not return an object. So use

var_name = selection(i).GetContent.string

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

the correct code is

var_name = (selection(i).Text)

then it works.