Page 1 of 1

combine a numeric variable and an alpha variable

Posted: July 18th, 2023, 4:28 pm
by cliford94
Good morning! I have a problem. I would like to combine a numeric variable and an alpha variable into a single variable to create an identification code. I do not know how to do

Re: combine a numeric variable and an alpha variable

Posted: July 19th, 2023, 8:11 am
by vgonzalez
Good morning,

For this you can make use of the CONCAT function, which allows you to concatenate texts.

https://www.csprousers.org/help/CSPro/c ... ction.html

In the case of concatenating with variables of type integer, use the edit function for each integer variable, which returns a character string of the numeric value.

https://www.csprousers.org/help/CSPro/e ... ction.html

Example

Province = 1;
Distrit = "02";
strProvince = EDIT("99", Province);

Then you use that variable within the concatenation you want to perform.

ID_Map = CONCAT(strProvince , Distrit);

I hope you find it useful

Re: combine a numeric variable and an alpha variable

Posted: July 19th, 2023, 9:00 am
by cliford94
Hello!
I tried to combine two texts with this code but it doesn't work.


PROC A5
A3 = "AA";
A4 = "BBBB";
string A5 = concat(A3," ", A4); // A5 is: TT BBBB

Re: combine a numeric variable and an alpha variable

Posted: July 19th, 2023, 10:42 am
by justinlakier
Hello,

The code snippet you provided is in the postproc of A5, and uses A5 as the name of both a proc and a string variable, which is not allowed. Without the context of the rest of the app it's difficult to tell where the item A3 might be set to "TT" rather than being set to "AA". You can try testing concatenating with string variables to see how concatenation should be working and where your dictionary items have unexpected values.

Hope that helps,
Justin

Re: combine a numeric variable and an alpha variable

Posted: July 19th, 2023, 10:19 pm
by cliford94
Hello
Many thanks for your help.