cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.1 : Concatenating 30 (char) fields

Former Member
0 Kudos

Hi All,

Is there any way(without using UDFs) that we can concatenate 30 fields and map it to target field? The main challenge is that these fields have to be sent as in fixed length structure.

For Ex:

Assume 'fieldA' needs to occupy first 4 positions in the target field but it comes with length 1. In such a case we need add that many blanks to 'fieldA' and concat.

Please suggest if there's any way(at least in PI 7.1) to handle this without using UDF.

Thanks,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This requirement can be achieved without using UDF. Standard graphical mapping will be easy to meet but would become big.

You can fix the length of the field by using the "nameA.fieldFixedLength" in the content conversion tab of File Adapter. Remaining configurations are as usual.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Vishal,

Please see shrutis thread and you have a udf over there. It is a very simple one not a complex one. Take one input str and put the code given. In the udf he is padding up with zeros so instead you need to pad with space. So change only that line to:

str=" "+str;

Rest everything should work for you. Since your input is dynamic we cannot achieve with standard functions.

Regards,

---Satish

Former Member
0 Kudos

No this is not possible using std functions. Unless if your source value is fixed.

Consider if fieldA have the value length as 1 or 2 or 3 etc.. Then its not possible to use the Constant (dynamic spaces).

Best Bet is to use UDF

Regards

Ramg

Shabarish_Nair
Active Contributor
0 Kudos

2 things;

1. this is definitely possible using the standard concat function

2. and obviously a UDF

but since you input is large in number i.e 30 it is ideal to have a UDF instead of building the same logic using a graphical standard function. The reason basically being the readability obviously.

former_member472138
Active Contributor
0 Kudos

Hello Vishal,

What is stopping you to use UDF, it is very simple. And definitly gives confusion if you use graphical mapping since the readibility would be large.

Always prefer the best way.

Regards

PY.

Former Member
0 Kudos

Hi Vishal,

U can do it without udf, may be it will be too lengthy and confusing.

u can first check for the length of each fields , then use a FormatNum to adjust the length and then use the concat function to concat each field.

field1 concat field2 = result1.

result1 concat field3 = result2

continue in tis way.You can also refer the following link,