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: 
Ramsingh
Contributor
Contributor

Flag creation in backend

Hi All ,

I have below table and i wann create flag in the backend 

ID , Country/City

1,AS

1,BU

1,AP

2,ZZ

2,UP

When  create the flag  backend .

When i click ID -1 in front end, For country AS,BU,AP it should be 'Y' and for 'N' for ZZ,UP

similarly when i click on ID-2 . 'Y' as ZZ,UP and 'N' to AS,BU,AP .

 

Advance Thanks

Ram

1 Solution

Accepted Solutions
Kushal_Chawda

You can do it via script but it will be complex as flag need to be changed dynamically based on selection. So it will be better to do it in frond end instead. You can get it worked on multiple selections as well.

LOAD *
Inline [
ID , Country
1,AS
1,BU
1,AP
2,ZZ
2,UP
3,NP
3,KP] ;

Create variable on front end  named vIDSelection with below expression

=GetFieldSelections(ID)

Create straight table with Dimension Country ,ID and below calculated dimension for Flag

=aggr(if(GetSelectedCount(ID)=0,'Y',
if(Index(vIDSelection,only({1}ID)),'Y','N')),Country)

 

create a measure in straight table to exclude ID selection and then you can hide this column or you can include below highlighted set in other measure

=count({<ID>}Country)

Annotation 2020-08-21 105557.png

Annotation 2020-08-21 105624.pngAnnotation 2020-08-21 105648.png

View solution in original post

7 Replies
Kushal_Chawda

You can do it via script but it will be complex as flag need to be changed dynamically based on selection. So it will be better to do it in frond end instead. You can get it worked on multiple selections as well.

LOAD *
Inline [
ID , Country
1,AS
1,BU
1,AP
2,ZZ
2,UP
3,NP
3,KP] ;

Create variable on front end  named vIDSelection with below expression

=GetFieldSelections(ID)

Create straight table with Dimension Country ,ID and below calculated dimension for Flag

=aggr(if(GetSelectedCount(ID)=0,'Y',
if(Index(vIDSelection,only({1}ID)),'Y','N')),Country)

 

create a measure in straight table to exclude ID selection and then you can hide this column or you can include below highlighted set in other measure

=count({<ID>}Country)

Annotation 2020-08-21 105557.png

Annotation 2020-08-21 105624.pngAnnotation 2020-08-21 105648.png

Ramsingh
Contributor
Contributor
Author

Hi Kush ,

thanks for replying , i need it on back-end as i have other calculations  & need to store in qvd  .

Just to change the question a bit 
Instead of Flag , can i somehow map ID-1 to ZZ,UP country and ID-2 to AS,BU,AP country 

( its basically mapping ID's to greyed  out Countries list )

This also can work for me .

Please note i have millions of record , Outer join could get the app hanged mostly 

Kushal_Chawda

Now I bit confused that what was your question. 

Originally it was " When i click ID -1 in front end, For country AS,BU,AP it should be 'Y' and for 'N' for ZZ,UP"

Now,Instead of Flag , can i somehow map ID-1 to ZZ,UP country and ID-2 to AS,BU,AP country .

These are totally different. Can you please provide with example what exactly do you need?

Ramsingh
Contributor
Contributor
Author

 

Sorry for making it confusing , Below is example So for ID-1 is mapped for Ind ,Aus,Pak and ID-2 as SA , US

what i need is reverse mapping ( map ID-1 to SA, US and map ID-2 to Ind,Aus,Pak  )

so basically for each ID mapping the grey out country list should be mapped 

Ramsingh_1-1598021290107.png

Output required : ( So for ID-1 , SA and US should be in white and Ind , Aus , Pak should be greyed out )

similarly for ID-2

Ramsingh_2-1598021703700.pngRamsingh_3-1598021737878.png

Hope I'm clear .

Please note : i could required in backend and data has millions of record so any joins could mostly hang 

Kushal_Chawda

There could be many ID's in your data so let's say there is ID 3 with other country. So when you select ID=1, it include all the other ID's country? What if you select ID 1 & ID 2 both?

Ramsingh
Contributor
Contributor
Author

Yes for ID=1 , it could include all other ID's country as well ( all greyed out values ).

I'm looking for each ID calculated in create table /data out of it . So for each ID , it could include all other ID's country as well . There is no selecting of ID's  here
hope I'm clear 

Kushal_Chawda

Is there any specific reason you want to do this way? Because it will complicate the things. If I know the reason then I could advise better way of doing it