Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Question about mapping

Hi,

Please i have a question about mapping

i have field called Activity

which has the values of 1,2,3,4

i want to represent them with names A,B,C,D

so i made mapping

LOAD * Inline

[

Activity , Name

1,A

2,B

3,C

4,D

];

when i select Name it reflects to the Activity

but when i used the Activity in the expression it doesn't reflect anything

hope the attached example clarify the problem

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Also I am just guessing:

=Sum({$<Activity={'$(=concat(ActivityNew,chr(39)&','&chr(39)))'}>}Value)

allows to assign multiple ActivityNew values to be assigned to Activity.

View solution in original post

15 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Hi Mona,

I've fixed this up for you and offered an alternative using ApplyMap() - just comment out the top part of the script and uncomment the second part.

Hope this helps,

Jason

swuehl
MVP
MVP

Mona_qlik,

if you want to keep the tables not linked, you could just remove the second load from the script and change your expression in the table to

=sum(if(Activity=NewActivity,Value))

Table1:

LOAD * Inline

[

Activity,Value

1,200

1,400

1,300

2,50

2,300

3,340

3,690

4,300

4,90

];

//LOAD Activity as ActivityNew

//Resident Table1;

LOAD * Inline

[

ActivityNew,Name

1,A

2,B

3,C

4,D

];

Regards,

Stefan

P.S. Or use a mapping load with your second table and applymap in your first (you need to change the order of your tables though)

P.P.S: I would prefer Jasons second solution (essentially what I meant with my first P.S., just saw his after comitting my post)

edited by swuehl

Not applicable
Author

thanks Jason for your help

but in my case as i attached iun the document i have to create another field resident the first one but this not working in the expression

i.e the field that's not reflected is the ActivityNew not the Activity

Hope the problem now is clear

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Sorry Mona but I don't really understand what you're trying to achieve.  Are you saying you want 2 fields with exactly the same values in them, one called Activity and one called ActivityNew?

swuehl
MVP
MVP

I also don't really get what you want Mona.

If you need to keep your data model (maybe because we dont't understand your whole picture), you could use

=Sum({$<Activity={'$(=only(ActivityNew))'}>}Value)

in your table to get your / some / any results (because I ... see above).

Regards,

Stefan

Not applicable
Author

Sorry Stefan and Jason

i know that my problem is complicated so above i attached a simplified example but not the real case so you can't understand what i want to do

Actually the last expression Stefan has posted is working in the case that (A) For example is reflected to (1)

which is

=Sum({$<Activity={'$(=only(ActivityNew))'}>}Value)

but what if the mapping for Name (A) is related with 2 activities (1 and 2 for example)

and i want the above expression to work with them??

Jason_Michaelides
Luminary Alumni
Luminary Alumni

If I understand you correctly (and I'm afraid I'm still not sure I do!) then both my solutions would still work in this case.  Just add the second mapping to the Map table:

Activity_Map:

LOAD * Inline

[

Activity,Name

1,A

2,B

3,C

4,D

5,A

6,A

7,A

];

Jason

swuehl
MVP
MVP

Also I am just guessing:

=Sum({$<Activity={'$(=concat(ActivityNew,chr(39)&','&chr(39)))'}>}Value)

allows to assign multiple ActivityNew values to be assigned to Activity.

Not applicable
Author

yes Jason i did it

but now i want an equal expression to the one Stefan posted

=Sum({$<Activity={'$(=only(ActivityNew))'}>}Value)

to be used in the case of 2 Activities has the same name

is that clear?