Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
new_user30
Contributor II
Contributor II

How to show both text and date values in a single field in Straight table?

Hi,

Consider 2 fields, Field 1 and Field 2.

Field 2 is in Date format.

Logic to populate Field 2 :

      if Isnull(Field 1) then 'NA' else Field 2 as Field 2

Here the value NA is not populating since the value Field 2 is in date  format and 'NA' is text.

I tried with Text(Field 2), Text(Date(Field 2'MM/DD.YYYY'))  etc...

Still 'NA' is not coming.

Thanks,

Neetha

1 Reply
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Neetha,

This code worked just fine for me:

load *,

if(isNull(Field1),Text(Field2),'NA') as Field3;

load if(len(Field1)>0,Field1,Null()) as Field1,

Date#(Field2,'DD/MM/YYYY') as Field2;

load * Inline

[

Field1,Field2

,01/01/2018

Test,02/04/2018

];

sample.png

As you can see, the Field2 is a numeric field, due to it being aligned to the right and Field3 is a text field, since its aligned to the left.