16 Replies Latest reply: Aug 20, 2015 8:08 AM by koti d RSS

    Combine 4 numbers, problems with 'NULL'

    Philipp Schöck

      Hi all,

       

      I have to combine 4 Numbers in the following way:

       

      WG1WG2WG3WG4WGR
      11251-1-2-5
      23662-3-6-6
      171-7- -

       

      I would like to tell QlikView to combine the fields like this

       

      WG1 & '-' & WG2 & '-' & WG3 & '-' WG4'

       

      The Problem is, in this case I recieved a Result like in the last line of the table.

      Then I tried some combinations with if, like this:

       

      if(wg1>0,wg1,)&if(wg2>0,'-'&wg2,)&if(wg3>0,'-'&wg3,)&if(wg4>0,'-'&wg4,) as WGR

       

      But the result is also not correct in every line.

       

      I was thinking if there is a possibility to setup the 'Else' in the 'If' condition to NULL like this:

       

      if(wg1>0,wg1,Null)&if(wg2>0,'-'&wg2,Null)&if(wg3>0,'-'&wg3,Null)&if(wg4>0,'-'&wg4,Null) as WGR

       

      But of course in this way it do not work.

       

      It would be so nice if anybody can help me with that