a.omz
a.omz

Reputation: 17

Something similar: Substring but for integer - Progress4gl

Hi Can someone help me with a question, please?

I have an integer in a cell in a spreadsheet and I only want to grab the first 6 digits out of the 7 in the cell from my input/read data set. How do I do that?

For a string, I would do something like:

...after def all relevant var and source documents:

variablexyz = substring(data[1]1,6) - right?

How do I do the same thing for an integer?

Thank you.

Upvotes: 0

Views: 185

Answers (1)

Mike Fechner
Mike Fechner

Reputation: 7192

I would suggest math and not string manipulation in that case.

DEFINE VARIABLE i     AS INTEGER     NO-UNDO.
DEFINE VARIABLE iData AS INTEGER     NO-UNDO INITIAL "1234567".

i = ROUND (iData / 10 - .5 , 0) . 

MESSAGE i
    VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.

Upvotes: 1

Related Questions