Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL select statment in vbscript macro

hi,

I need a sql select statement in a macro to query a particular value of a field. How can I do that??

Thanks..

5 Replies
tanelry
Partner - Creator II
Partner - Creator II

If you mean to query value from your loaded data, not external source, then
activedocument.Evaluate()
allows to retrieve or calculate a value using QV native syntax .

sls = activedocument.Evaluate("sum(if(CustomerID=1,Sales))")

Not applicable
Author

Thanks,

yes, I want to query from the loaded data. I am doing the following, but there seems to be an error. What I want to do is to query a field1 of a table, where field2 = 1

s = ActiveDocument.Evaluate("if(COLUMN_1=1,COLUMN_2)")

tanelry
Partner - Creator II
Partner - Creator II

I think you should use some aggregation function, like only()

s = ActiveDocument.Evaluate("only(if(COLUMN_1=1,COLUMN_2))")

I suggest you debug your syntax inside a text object before using in macro. If it works in text object then it works in macro.

Not applicable
Author

Thanks, it works now

Not applicable
Author

Can I evaluate an expression also independently from the selections, including also the not selected values??