Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sibideepak
Creator II
Creator II

If statement doesn't return anything

Hi all ,

I have an if statement which i want to return returns '{"=$(vMargin2)>.30"}' but it returns nothing .. condition works fine but

still can return other string not this .. I could able to sort out issue .. what can be the problem or any syntax mistakes ??

where vMargin2 = {"=((Sum({<DocDate={'$(vTempID)'}>}LineTotal)-sum({<DocDate={'$(vTempID)'}>}LineNLC))

/Sum({<DocDate={'$(vTempID)'}>}LineTotal))$(vMarginSelect)"}

Thanks in Advance .,

8 Replies
awhitfield
Partner - Champion
Partner - Champion

What's the if statement?

sibideepak
Creator II
Creator II
Author

Hi,

=If(GetFieldSelections(Margin%,'','','GroupA')='>30%','{"=$(vMargin2)>.30"}')

stigchel
Partner - Master
Partner - Master

Well there are a lot of options here, but if I'm guessing....

=if(Only({GroupA} Margin%) ='>30%','{"=$(vMargin2)>.30"}')

- Use Only because you are expecting only one value anyway

- Assuming GroupA is an alternate state (GetFieldSelections has only two arguments)

- Assuming there is one selected value in Margin% in the GroupA state

Anonymous
Not applicable

GetFieldSelections does actually have 4 possible arguments, including the Field. The last one is the state..

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

Returns a string with the current selections in a field. It is possible to query an alternate state.

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.

State is the alternate state to query.

The string that is returned can be in these forms:

   

'x, y,z' If the number of selected values is Maxvalues or less, the string returned is a list of the selected values, separated with Valuesep as delimiter.
'NOT x, y, z' If the number of non-selected values is Maxvalues or less, the string returned is a list of the non-selected values, separated with ValueSep as delimiter, and NOT as a prefix.
'x of y' If the number of selected values ( x) is more than Maxvalues, but less than the total number of values (y) less Maxvalues.
'ALL' If all values are selected.
'-' If no value is selected.
<search string> If you have selected using search, the search string is returned.

Examples

getfieldselections ( Year )

getfieldselections ( Year, '; ' )

getfieldselections ( Year, '; ' , 10 )

sibideepak
Creator II
Creator II
Author

Hi Kim Rørmark,

Getfieldselection isn't a problem here.

Anonymous
Not applicable

I know, I just wanted to point out that GetFieldSelection actually accepts a state argument.

How does your data look. Could you create some example-tables?

stigchel
Partner - Master
Partner - Master

Ah, sorry.. this was added after the SR3 version I'm using

sibideepak
Creator II
Creator II
Author

It's added in SR8 I think .,