0
votes

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.

1

1 Answers

1
votes

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.