Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Highlighted
Valued Contributor

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
Partner
Partner

Re: Launch URL based on Conditions

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
Highlighted
Valued Contributor II

Re: Launch URL based on Conditions

Hi,

send your initial script please.

Thanks in advance

André Gomes

Highlighted
Valued Contributor

Re: Launch URL based on Conditions

Hi Andre,

There is no specific script involved here.

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

Thanks & Regards

Jeba

Highlighted
Valued Contributor

Re: Launch URL based on Conditions

Any help will be highly appreciated

Partner
Partner

Re: Launch URL based on Conditions

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

Highlighted
Contributor II

Re: Launch URL based on Conditions

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.

Highlighted
Partner
Partner

Re: Launch URL based on Conditions

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

Highlighted
Contributor II

Re: Launch URL based on Conditions

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

Highlighted
Valued Contributor

Re: Launch URL based on Conditions

Hi Charles,

It seems working and I am testing now.

Thanks & Regards

Jeba

Highlighted
Valued Contributor

Re: Launch URL based on Conditions

Hi Giacomo,

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

Thanks & Regards

Jeba