Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Currently Selected field

Hi Guys,

     Thanks for ur support in this forum.

     Please help to find out this trick.

     I need to get currently selected field to use in a chart. Mns I have a field named 'Project Type'

     It has three values like 'Maintenance', 'Development', 'Consultancy'.

     I want to show text box when the value of [Project Type] is 'Maintenance'

     Thanks in advance.

6 Replies
Not applicable
Author

In Text Box -> Layout -> Show (Conditional -> [Project Type] = 'Maintenance').

When ever you select the Maintenance this text box would be displayed in your chart.

Anonymous
Not applicable
Author

Hey,

Take a look at the GetFieldSelections() function.

From F1 help:

getfieldselections( FieldName [, ValueSep [, MaxValues]] )

Returns a string with the current selections in a field.

ValueSep is the separator to be put between field values. The default is ', '.

Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6. 

Examples

getfieldselections ( Year ) 

getfieldselections ( Year, '; ' ) 

getfieldselections ( Year, '; ' , 10 )

(EDIT: Ah, I seem to have misunderstood the question. Thought you wanted to show the current selection that you had made, in a text object)

pat_agen
Specialist
Specialist

hi,

use the function getfieldselections().

This will show what you have selected in the field [Project Type].

So if I understood your request you want to display a text box when [Project Type] is "Maintenance".

Create your text box, on the Layout tab make "Show" conditional with the following expression:

if(getfieldselections([Project Type])='Maintenance',1,0)

Conditionaltextbox.png

Not applicable
Author

Hi pat,

     Thanks for ur reply.

     I tried in ur way. But still I m not getting the result as I needed.

     I m using QV 10 SR2. Is thr any pblm with tat?

     Please clarify this.

     Thanks

pat_agen
Specialist
Specialist

hi,

don't know about the version issue and can't test it but I'd be very surprised.

Start by creating a text box without the "show" condition expression.

in the tex box put the expression:

=getfieldselections([Project Type]).

now start selecting on your [Projetc Type] field. What happens to the text box? This should display the selected value of [project Type] when one and only one value has been selected. Is this the case? If not there is a typo. 

The idea is to test the result of the above expression against the string 'Maintenance' and show the textbox if this condition is met.

try again - I tested it her and it works (v8.5).

by the way  Sivasubramanian's solution woul ddo the job too.

good luck.

Not applicable
Author

Hi pat,

     Again I ve tried it as u said.

     It works perfectly in the text but not in the show condition expression.

     I dono y happening like this... But before I ve tried with other chart types. I didn't face any pblm like this.

     I ll try to find out wats the pblm in this n ll post u.

     thanks.