IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Page 2 of 2 < 1 2
Topic Options
#52156 - 07/28/15 06:36 AM Re: I want to add leading Zero [Re: GBowlsby]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc

Code:
=(right('000000' + inttostr(strtoint(field('SeqNo'))+1), 6))


You first have to convert the field value to an integer, add 1 to it, then convert the result back to a string, which explains the slightly convoluted expression.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#52165 - 07/28/15 11:22 AM Re: I want to add leading Zero [Re: GBowlsby]
GBowlsby Offline
OL Expert

Registered: 08/07/14
Posts: 167
Loc: Tallahassee FL
Perfect, now need to add that when the seqno number = 0 do not subtract. Otherwise I get 0000-1 but all others are working perfectly. I might create a condition to fix that

Top
#52168 - 07/28/15 02:20 PM Re: I want to add leading Zero [Re: GBowlsby]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
Code:
=(right('000000' + inttostr(if(strtoint(field('SeqNo'))<=0,1,strtoint(field('SeqNo')))-1), 6))

This code uses an inline condition and always return "000000" if the SeqNo value is equal to or less than 0.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#52170 - 07/28/15 02:57 PM Re: I want to add leading Zero [Re: GBowlsby]
GBowlsby Offline
OL Expert

Registered: 08/07/14
Posts: 167
Loc: Tallahassee FL
PERFECT!!!! Thank you Philippe. smile

Top
#52420 - 09/22/15 10:35 AM Re: I want to add leading Zero [Re: GBowlsby]
northcoast55 Offline
OL Newbie

Registered: 09/22/15
Posts: 3
DSNYRR

Top
#52422 - 09/22/15 10:53 AM Re: I want to add leading Zero [Re: GBowlsby]
northcoast55 Offline
OL Newbie

Registered: 09/22/15
Posts: 3
DATA SELECTIONS ARE
ACCOUNT = A123456789
NET = 46.95
GROSS = 48.95
NEED A STRING 27 CHAR
10 FOR ACCOUNT
8 FOR NET
8 FOR GROSS
AND 0 AT END

USING THIS
=@(1,14,14)+@(1,15,23)+'000000' +@(1,34,39)+@(1,41,42)+'000000' +@(1,84,89)+@(1,91,92)+'0'
BUT GET
A123456789000000 4695000000 48950
SHOULD BE
A12345678900004695000048950

THE ZEROS DON'T PAD ALWAYS GET 6

Top
#52426 - 09/22/15 11:36 AM Re: I want to add leading Zero [Re: GBowlsby]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
Trim the spaces from each of your selections : trim(@(x,x,x))


Edited by Philippe F. (09/22/15 11:36 AM)
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
Page 2 of 2 < 1 2