John's correct - you're likely in BASICTYPE 'P' which requires the format
X = FMT(X,'R%4')  - note that it will truncate the value if it's more than 4
characters. I usually just to a simple LEN check first:

IF LEN(X) < 4 THEN X = FMT(X,'R%4')

If the basictype issue has you confused then I would strongly recommend you
not set/change it. Simply realize which you work in and work with it. Most
of the help/documentation is for 'U' format - but "standard" pick
documentation should show the syntax required. The UD docs *usually* note
when there are basictype differences but don't always make them clear.

Good luck
Colin Alfke
Calgary, Canada

-----Original Message-----
From: Bob Woodward

Hi Group,

 

I don't know why this is kicking my butt but I'm trying to do a simple X
= FMT(X,"4\0R") statement, straight out of the HELP UNIBASIC listing and
I can't seem to get it to work.  The problem is the fill character, in
this case the number zero, but what I get back is just the letter "R",
without the quote marks.  I get pretty much the same result no matter
what fill character I use.  I simply want to format a number to be 4
characters long with leading zeros.  If X="1", then it should result in
X="0001", or so I've been lead to believe.

I know that X = ("0000":X)[4] works to get my results but FMT should
work, too.  The major benefit is that if the number is more than 4
digits, FMT won't truncate it.  I hope.....

Environment is UniData 6.1 on a Windows server.   Comments anyone?

Thanks,

BobW


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to