15 Replies Latest reply: Sep 6, 2011 6:22 AM by mona_qlik RSS

    Question about mapping

    mona_qlik

      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

        • Re: Question about mapping
          Jason Michaelides

          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

            • Question about mapping
              mona_qlik

              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

                • Question about mapping
                  Jason Michaelides

                  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?

                  • Question about mapping
                    swuehl

                    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

                      • Question about mapping
                        mona_qlik

                        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??

                  • Re: Question about mapping
                    swuehl

                    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