Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
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
MVP & Luminary
MVP & Luminary

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