combine a numeric variable and an alpha variable

Discussions about CSEntry
Post Reply
cliford94
Posts: 3
Joined: July 18th, 2023, 3:53 pm

combine a numeric variable and an alpha variable

Post 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
vgonzalez
Posts: 30
Joined: March 12th, 2020, 4:19 pm
Location: VENEZUELA

Re: combine a numeric variable and an alpha variable

Post 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
cliford94
Posts: 3
Joined: July 18th, 2023, 3:53 pm

Re: combine a numeric variable and an alpha variable

Post 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
justinlakier
Posts: 218
Joined: November 21st, 2022, 4:41 pm

Re: combine a numeric variable and an alpha variable

Post 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
cliford94
Posts: 3
Joined: July 18th, 2023, 3:53 pm

Re: combine a numeric variable and an alpha variable

Post by cliford94 »

Hello
Many thanks for your help.
Post Reply