Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Cust variable - I have defined in the Select in field OnOpen has action
Sub Customer
set CustomernoVar = ActiveDocument.Variables("Cust")
vCustomerNo = CustomernoVar.GetContent.String
msgbox(vCustomerNo)
if vCustomerNo = ActiveDocument.Fields("Customer_No").getPossibleValues then
msgbox(" Valid Customer")
ActiveDocument.Fields("Customer_No").Select(vCustomerNo)
else
msgbox("The customer is not valid")
end if
End sub
"Customer_No" is the data field in qlikview datamodel.
I have to check the incoming variable value is valid customer or not in the field "Customer_No".
It is not working- if I provide invalid value for the Cust variable - it is not suppose to display anything. Please help on this issue.
Advance Thanks for your help
Here is example code from the API Guide that shows how to loop through each possible value in a field.
You will need to compare vCustomerNo with each possible value and set a flag if you find a match.
set val=ActiveDocument.Fields("Month").GetPossibleValues
for i=0 to val.Count-1
msgbox(val.Item(i).Text)
next
Let me suggest a non-macro way to accomplish the objective. Assume the Fieldname is "Customer" and the variable name if "vCustomer".
1. Create a bookmark using the search expression:
=Customer='$(vCustomer)'
2. Create an alert that applies the bookmark and uses for condition:
=GetSelectedCount(Customer)=1
3. Assign an OnOpen action to apply the bookmark if you want the selection made.
Example attached.
-Rob
Hi Rob,
Thanks for the quick solution.
It is not going to work for my case.
Cust is always carry some values -I would like to verify the incoming Cus t values are available in the Customer_No field or not.If Cust has value which is not available in Customer_No - I don't need to show the report.
Advance thanks for your help.