Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Launch URL based on Conditions


Hi Team,

I have a button which launches the external URL.

I would like to launch only if the user selects few mandataory fields ,if not just display an error message.

Thanks & Regards

Jeba

1 Solution

Accepted Solutions
giacomom
Partner - Contributor III
Partner - Contributor III

Hi Jebamalai,

you can use the Enable Condition field in the General tab of the button properties window as shown in the figure attached below.

You can control if the user selects a certain field using GetSelectedCount(YOUR_FIELD_1)>0 expression.

If you have more fields you can just AND them like this:

     GetSelectedCount(YOUR_FIELD_1)>0 AND GetSelectedCount(YOUR_FIELD_2)>0 AND ...

Screen.PNG

If you want to make an error message appear in a popup window you should use a macro.


Regards,

Giacomo

View solution in original post

9 Replies
agomes1971
Specialist II
Specialist II

Hi,

send your initial script please.

Thanks in advance

André Gomes

Anonymous
Not applicable
Author

Hi Andre,

There is no specific script involved here.

In the Button click - > Add ->External->Launch->Application - Here is my URL.

Thanks & Regards

Jeba

Anonymous
Not applicable
Author

Any help will be highly appreciated

giacomom
Partner - Contributor III
Partner - Contributor III

Hi Jebamalai,

you can use the Enable Condition field in the General tab of the button properties window as shown in the figure attached below.

You can control if the user selects a certain field using GetSelectedCount(YOUR_FIELD_1)>0 expression.

If you have more fields you can just AND them like this:

     GetSelectedCount(YOUR_FIELD_1)>0 AND GetSelectedCount(YOUR_FIELD_2)>0 AND ...

Screen.PNG

If you want to make an error message appear in a popup window you should use a macro.


Regards,

Giacomo

cspencer3
Creator II
Creator II

You could take Giacomo's idea a little bit further and use the button to show an error text box if the proper selections are not made. You could add to actions to your Button, one which launches the URL and another that conditionally sets a variable.  So for your url launch you could do an if statement like:

if GetSelectedCount(Field1) >0 and GetSelectedCount(Field2) >0, Launch URL)

Then on your Variable setting action do

if GetSelectedCount(Field1) <> 0 and GetSelectedCount(Field2) <>0, 1, 0)

Use this variable to conditionally show a text box that would pop up (hide or undhide) based on the variable switched above. If i use an error box like that i put another button in the top corner of the box that  uses the same hide/unhide condition to reset the variable to zero and allows the user to 'Cancel' the error box. Thus removing it from the screen.

giacomom
Partner - Contributor III
Partner - Contributor III

If you want to use a macro you can:

1 - set a variable (Ctrl+Alt+V) vButtonEnabled=if(GetSelectedCount(Field1)>0 and GetSelectedCount(Field2)>0, 1, 0)

2 - add a Run Macro action to the button

3 - create the macro like in the figure

Screen.PNG

Note: substitute RunExe ("YOUR_PATH") with CreateObject("WScript.Shell").Exec("YOUR_PATH") in the script to launch the app.

In this case every time the user clicks on the button, the macro values the variable and if it is equal to 1 (the fields required are selected) launches the application, otherwise shows a popup window with the error message.

Regards,

Giacomo

cspencer3
Creator II
Creator II

Attached is a QVW example, It would be one option, and is nothing pretty but demos the concept.

Anonymous
Not applicable
Author

Hi Charles,

It seems working and I am testing now.

Thanks & Regards

Jeba

Anonymous
Not applicable
Author

Hi Giacomo,

This worked exactly what I want and thanks a lot for that.

Thanks & Regards

Jeba