Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik Highlights 2020 Giveaway! Watch, reply and have a chance to win a $200 Amazon Gift Card! Watch Video
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

GetFieldSelections question

Hello!

I am creating a variable for when a building is selected. My expression for my building filter is: 

=Trim(Upper(Replace(building, '_', ' '))) & Trim(Upper(Replace(enter_building, '_', ' '))), now I"m trying to create a variable for GetFieldSelctions using my building expression but it doesn't work. 

Any ideas?

 

Thank you!

Labels (1)
1 Solution

Accepted Solutions

I guess you have building and enter_building both in your selection box... why do you need both? can you not create a new field in the script using your logic

Trim(Upper(Replace(building, '_', ' '))) & Trim(Upper(Replace(enter_building, '_', ' '))) as NewBuildingName

and then use this in your filter object with this expression for KPI

If(GetSelectedCount(NewBuildingName) = 1,
Concat(DISTINCT NewBuildingName),
'All buildings are reflected in the data below unless a building filter is selected')

or this

If(GetSelectedCount(NewBuildingName) > 0,
Concat(DISTINCT NewBuildingName),
'All buildings are reflected in the data below unless a building filter is selected')

View solution in original post

22 Replies

What exactly do you mean by this


@hammermill21 wrote:

now I'm trying to create a variable for GetFieldSelctions using my building expression


you are using an expression within  GetFieldSelections() function? I believe the function only takes field name and not an expression.

Creator III
Creator III

Hey Sunny,

 

Then that's my issue, if the function only takes a field name then it won't work.  I'm trying to figure out how I can display the building name that is selected with the current function I have.  

Can you show by a mean of an image or example what exactly are you looking for? May be you can use something like this

=Trim(Upper(Replace(GetFieldSelections(building), '_', ' '))) &
Trim(Upper(Replace(GetFieldSelections(enter_building), '_', ' ')))

or something using Concat.... like this

=Concat(Trim(Upper(Replace(building, '_', ' '))) &
 Trim(Upper(Replace(enter_building, '_', ' '))))
Creator III
Creator III

So what I want is when I select a building on the left-hand side, it shows up in my text box:

Capture.PNG

I tried  creating a variable with the GetFieldSelections() but I cna't with an expression. I tried using the one below but that doesn't work.

 

=Trim(Upper(Replace(GetFieldSelections(building), '_', ' '))) &
Trim(Upper(Replace(GetFieldSelections(enter_building), '_', ' ')))

 And when I use the Concat this happens:

Capture2.PNG

Try this

If(GetSelectedCount(building) = 1,
Concat(DISTINCT
Trim(Upper(Replace(building, '_', ' '))) & Trim(Upper(Replace(enter_building, '_', ' ')))
) )
Creator III
Creator III

Nope that doesn't return anything, not even an error. 

Have you selected a single building? Without selection it won't return anything. You need to select only 1 building.... for multiple.. try this

If(GetSelectedCount(building) > 0,
  Concat(DISTINCT
    Trim(Upper(Replace(building, '_', ' '))) &
    Trim(Upper(Replace(enter_building, '_', ' ')))
  )
)

If you want to see without selection, try this

Concat(DISTINCT
    Trim(Upper(Replace(building, '_', ' '))) &
    Trim(Upper(Replace(enter_building, '_', ' ')))
)
Creator III
Creator III

Thank you Sunny!

Concat(DISTINCT
    Trim(Upper(Replace(building, '_', ' '))) &
    Trim(Upper(Replace(enter_building, '_', ' ')))
)

This one worked 🙂

One last question, if I wanted to add a Calculation condition  I can't just write 

Concat(DISTINCT
Trim(Upper(Replace(building, '_', ' '))) &
Trim(Upper(Replace(enter_building, '_', ' ')))
) <= 1

Becuase that doesn't work, could I even add a calculation conditionto this?

May be this

If(Len(Trim(
Concat(DISTINCT Trim(Upper(Replace(building, '_', ' '))) & Trim(Upper(Replace(enter_building, '_', ' '))) )
) > 0