Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
Toya2323
Contributor
Contributor

Replace, need leading zeros

I have

Load;

Text('ID')                                                                   as ID,

Timestamp(`date`,'MM/DD/YYYY')    as "Order date"

From _________________;

 

 

Output:

ID                                 Order date

500001238               11/01/2018

0500001238            11/02/2018

000008734               11/01/2018

100007738              11/01/2018

0100007738            11/02/2018

0100007738_dd    11/02/2018

 

How do I replace 500001238 with 0500001238, 100007738 with 0100007738  keep the same order dates and not affect the two other rows?

Labels (2)
2 Replies
vmoreno2605
Creator
Creator

Hi! I dunno if you have some id's that start with 0, anyway this is a way to introduce a 0 at the begening of a value

 

TableName: 

Load

Text('0'&ID), //It needs to be TEXT datatype

ORDER_DATE

Resident Table;

 

I dunno if this is what you are looking for, 

GL!

jonathandienst
Partner - Champion III
Partner - Champion III

Just use the Text() function when you first load this field  from the source (ie not in a resident load -- the leading zero may have already been discarded at this point):

LOAD ...
     Text(ID) as ID,
     ...
FROM ...

The field will now be a text field where 0500 <> 500.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein