Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
dhanu_today
Creator
Creator

How to apply 'Prefix'

Hi Everyone,

I have field SEC_ACCT_NO which contains more than 15 digits and less than 15 digits. We have to show last 15 digits for that am using the ‘RIGHT’  function to get the 15 digits only.But how we can put Prefix’Zeros’ which are having less than 15 gitits.

Is their any function available in QV like Lpad,rpad in oracle.

The same has been attached.

Thanks,

Dhanu

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try:
If(Len(SEC_ACCT_NO)>0, Repeat('0',15-Len(SEC_ACCT_NO))&Right(SEC_ACCT_NO,15) ,SEC_ACCT_NO)  AS SEC_ACCT_NO_DERIVED

View solution in original post

11 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Hi Dhanu,

As I understood you need a result like everything in the same format without zeroes.

If so, you can use simple IF in the load script like

IF(len(SEC_ACCT_NO)>15,RIGHT(SEC_ACCT_NO,15),SEC_ACCT_NO) AS YourField

Regards,
Sergey
tresesco
MVP
MVP

Try:

Repeat('0',15-Len(SEC_ACCT_NO))&Right(SEC_ACCT_NO,15)

SergeyMak
Partner Ambassador
Partner Ambassador

So, probably I caught your idea try this in your load script

PFA an example. I've done it for a dimension.

IF(len(SEC_ACCT_NO)>15,RIGHT(SEC_ACCT_NO,15),REPEAT('0',15-LEN(SEC_ACCT_NO))&SEC_ACCT_NO) AS YourField

Regards,
Sergey
ashfaq_haseeb
Champion III
Champion III

Hi may be like this.

Regards

ASHFAQ

anbu1984
Master III
Master III

Like this..

Right(Repeat('0',15) & SEC_ACCT_NO,15)

rbecher
MVP
MVP

Hi,

I would use:

Right(Repeat('0',15) & Text(SEC_ACCT_NO) ,15)

- Ralf

Astrato.io Head of R&D
dhanu_today
Creator
Creator
Author

Thanks Tresseco and all ...Its working.But am getting the 15 digits as zero's even though the SEC_ACCT_NO  having '-'.i have to show if its as itself like '-'.

Thanks,

Dhanu

tresesco
MVP
MVP

Could you post a sample that demonstrates the issue?

dhanu_today
Creator
Creator
Author

Thats True.Any how am adding the sample app.