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

select in field using macro

hi there,

i wonder if its possible to select a value in a field, but instead using the field's value, use an expression that calculates the desired value to be selected...so instead of:

.doc.Fields("Year Quarter").Select "2016Q3"

do something like this:

.doc.Fields("Year Quarter").Select "=(Year(addmonths(vToday,-3))&'Q'&Num(Ceil(Num(Month(addmonths(vToday,-3)))/3)) )"

Any advise ?

Thanks!


PS I should mention that i do not want to use a variable that might contain the desired value...

1 Solution

Accepted Solutions
rubenmarin

Hi Philipp, you can try with:

ActiveDocument.Fields("Year Quarter").Select ActiveDocument.Evaluate("(Year(addmonths(vToday,-3))&'Q'&Num(Ceil(Num(Month(addmonths(vToday,-3)))/3)) )")

Just to comment: This sentence can be easily done with actions, consider if you can avoid the use of macros for this.

View solution in original post

2 Replies
rubenmarin

Hi Philipp, you can try with:

ActiveDocument.Fields("Year Quarter").Select ActiveDocument.Evaluate("(Year(addmonths(vToday,-3))&'Q'&Num(Ceil(Num(Month(addmonths(vToday,-3)))/3)) )")

Just to comment: This sentence can be easily done with actions, consider if you can avoid the use of macros for this.

marcus_sommer

Each valid expression like: activedocument.fields("Class").select "=count(Member)>200" or valid search-strings like in here: Compound Search - demystified‌ will work. But like Ruben mentioned: try to avoid macros.

- Marcus