1 Reply Latest reply: Feb 4, 2011 11:35 AM by Neil Miller RSS

    Combining 2 Queries in Load statement


      In the QV script I have the below 2 functions that seem to work ok seperately, but I'm actually trying to combine them so I can put a list field on the page that will drill the charts accordingly.

      ApplyMap ('ratm', [Rate Code] )as [Structured or Unstructured],

      if(mid(Opics,6,2)<>'AL','Unstructured','Annuity') as Annuity,

      What I would like it to say is , if the mid digits in 'OPICS' is AL call it Annuity, if its not go to map and apply accordingly , call this result [Structured/Unstructured]

      I have tried many combinations but I think it should look something like this but its just not working

      if(mid(Opics,6,2)<>'AL','Annuity',ApplyMap(ratm',[Rate Code])) as [ Structured or Unstructured],

      Can anyone please help ?

      Thanks Anne

        • Combining 2 Queries in Load statement
          Neil Miller

          Could you add a second load to get the result you want?

          First load up everything, including the ApplyMap on your first load (skip the Mid portion for now). Rename the field with the ApplyMap() to StrUnstr or something like that.


          LOAD Dimensions,
          if(mid(Opics,6,2)<>'AL','Unstructured',StrUnstr) as [Structured or Unstructured]
          RESIDENT TableName;

          DROP FIELD StrUnstr;

          In place of Dimensions, add any fields that are necessary to define the key in the main table. Doing it this way, you first load the appropriate ApplyMap values and then on the second run, you choose whether or not to use that value. Since the table is already in memory, it shouldn't slow you down too much.