Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable icon to trigger field selection

Dear Community,

I am now trying to use variable to trigger a field selection.

My requirement:

If i click on grey variable icon, the twitter field will be selected and the icon is turned to red variable icon.

If i click on red variable icon, the twitter field will be De-selected and the icon is turned to grey variable icon.

1. Add action to the field

2. Add action to variable

3. if i click on the red variable icon, it will trigger to select the socialchannel as shown below:

4. if i click on that red variable icon, it will turn to grey variable icon, and deselect socialchannel as shown below:

5. Problem come when I click on the grey variable icon, it shows the red variable icon, but the twitter field in socialchannel is not selected. No matter how many times i click on grey and red icon, the field is not selected anymore.

6. It can work only i click on the twitter in the list box selection, but again only work for one time. I dunno why the field is not selected and deselected accordingly to the change of variable.

Anyone can help?

Thanks and best regards,

Chanel

17 Replies
preminqlik
Specialist II
Specialist II

hi chanel....

first u prepare a list box with all field values... try what i did before....lets c ...

Not applicable
Author

I am not sure why the other socialchannel icons cannot work properly as Twitter.

For example 'Blogs':

First click to select - Success

2nd click to deselect - Fail

If I select Twitter then the grey blog icon appears!

Attached with latest edited .qvw file. Kindly assist.

Thanks and best regards,

Chanel

Not applicable
Author

Hi Steve,

Thanks for proposing so many ways to solve it. I tested them but seems like not working correctly.

Attached herewith the .qvw file, icons at the left hand side is show conditionally with your provided code, but it is not working accordingly.

Solution at the right hand side is working, but we can only select one value in the field, I am figuring how to select more than one value in the field, such as select both Blogs and Twitter... Appreciate if you could help!

For the toggle solution, I am not really sure how it should function, maybe you can help to edit the attached example?

Thanks and best regards,

Chanel

Not applicable
Author

Dear,

Please ignore my post on

However, I still cannot figure out how to select more than one values in SocialChannelSource field.

For ex: select Blogs and twitter.

Appreciate if you could help!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Chanel,

I have finally found a few moments to take a proper look at your example.  Please find attached a working example - I hope I have understood your requirements correctly.

The action for toggling is done using the Selection and Toggle Select options.  The on and off buttons have exactly the same code behind them.

The expression that decides which button is shown is this:

index(GetFieldSelections(SocialChannelSource), 'Twitter') > 0

or

index(GetFieldSelections(SocialChannelSource), 'Twitter') = 0

If you want all red buttons to show when nothing is selected (ie. everything is 'possible') then you could use this instead:

index(Concat(SocialChannelSource), 'Twitter') > 0

I have also added a few text boxes that toggle the next few social media channels.  Rather than having two buttons that show and hide this changes the colour of the text box using this code in the calculated colour field:

=if(Index(GetFieldSelections(SocialChannelSource), 'Boards') > 0, rgb(255, 20, 20), rgb(50,50,50))

If you created images that had white symbols with a transparent background to place over these text boxes you would have more control over colours etc. from within your document - just a thought.

Hope that helps.

Steve

Not applicable
Author

Dear Steve,

Awesome! It is working pretty nice:

But I am thinking there might be limitation or bug:

If i select one by one, it is working fine until facebook:

but when i tried to click on twitter to select it, it turned all other channels to grey:

But weird thing is if i select reversely from boards to blog, it is working pretty good!

I am not sure it is bug or some little mistakes I made in my document, so I attached again my .qvw file.

Again, thanks for your awesome help! I am nearly there!

Thanks and best regards,

Chanel

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Chanel,

The actions on the grey version of the Boards button had the wrong actions on there - it is setting a variable and selecting in field rather that doing a toggle in field as per the other buttons.

After doing some further playing with the document, you may well find things behave better if you use the code:

index(Concat(SocialChannelSource), 'Twitter') > 0

The reason for this is because if you select all items then the GetFieldSelections returns 'ALL', also if you pick all but Twitter it returns 'NOT Twitter' - this will throw out the highlighting.

You may also want to select all with a trigger on Open and on Reload, do this with a Select in Field and a value of *.  You also would want to select all when the selection is cleared (so you never have no selections - which will throw the first toggle).

I've tweaked your document so you can see that approach in action.

Hope it helps,

Steve

http://www.quickintelligence.co.uk/

Not applicable
Author

Dear Steve,

Amazing! I have nothing to say except Thank you Thank you Thank you!

Really appreciate for your supportive!

Warmest regards,

Chanel