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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
newqlikie
Creator
Creator

Selecting values which are included in a script

Hello together,

is there any possibility, that I can select different values (for example earliest year of a delivery (2009 or 2010 or 2011), medicinal product (Y / N),  etc) before I start a script?

1.) So I need to set some values which have to take account in the script.

Something like this:

Do you have a "medicinal product"? Y / N  => If I take Y, the data will be set in a variable (e.g. vMPdata='Y')

In the script should be something like this:

SQL SELECT SAARTNR  as REF,

    SAARTBEZ1 as Articledescription,

    SAMEDIK as AMKZ,

    SACHARKZ as LOTKZ

FROM QS36F.DLSSA where SAMEDIK=vMPdata;

2.) Also should there any checkup for all values I have to add. Only if I have added all values, I am able to run the sript

Do you have any ideas?

Thank you very much for your help.

11 Replies
Not applicable

Hi,

1) I am not sure of the objective in doing so but you can do this as follows:

Create Variables as needed and add them to a inputbox for the users to select them.

Then if you reload (which also can be done thru a button action with macro), the reload script if contains any value will run the script with the values.

2) While running the reload thru button with macro, add the necesary check in macro and reload only if the validation is passed.

Regards,

Kiran.

newqlikie
Creator
Creator
Author

Dear Kiran,

thanks for your help.

1) But how should the script look like? The one I added in the intro is not working.

2) How do I do the necessary checks for the variables?

The reload-macro looks like:

Sub ReloadStuff

ActiveDocument.Reload

End Sub

its_anandrjs
Champion III
Champion III

Hi,

You can put a button for this macro code and use this on the action command by giving macro name.

Sub ReloadStuff
ActiveDocument.Reload
End Sub

Rgds

Anand

newqlikie
Creator
Creator
Author

1) Do I have to do something like:

SQL SELECT SAARTNR  as REF,

    SAARTBEZ1 as Articledescription,

    SAMEDIK as AMKZ,

    SACHARKZ as LOTKZ

FROM QS36F.DLSSA where SAMEDIK=getfieldselections(vMPdata);

But in this way it is still not working.

Not applicable

Sub ReloadStuff

validVariable = ActiveDocument.GetVariable <VariableName>.GetContent.String

if <Conditon on validVariable> then

ActiveDocument.Reload.

end if

End Sub

newqlikie
Creator
Creator
Author

2) What do I have to do with more than one variable?

Would this be correct?

Sub ReloadStuff

validVariable1 = ActiveDocument.GetVariable <VariableName1>.GetContent.String

validVariable2 = ActiveDocument.GetVariable <VariableName2>.GetContent.String

if <Conditon on validVariable1> and <Conditon on validVariable2> then

ActiveDocument.Reload.

end if

End Sub

Not applicable

Yes, that would work. You can validate you VB Script in the below url:

http://www.w3schools.com/vbscript/tryit.asp?filename=vbdemo_intro

Kiran.

newqlikie
Creator
Creator
Author

Hi,

for the other case,

does nobody has any solution for following problem:

1) 

SQL SELECT SAARTNR  as REF,

    SAARTBEZ1 as Articledescription,

    SAMEDIK as AMKZ,

    SACHARKZ as LOTKZ

FROM QS36F.DLSSA where SAMEDIK=getfieldselections(vMPdata);

But this is not working. What do I do wrong?

Not applicable

When script is running, document isnt active hence getfieldselections which includes document operation as selecting will not work. While variables arent such and can be used.

Hope I am clear in the explanation,

Kiran.