cancel
Showing results for 
Search instead for 
Did you mean: 

Variable being overwritten in the Variable Substitution (File Adapter)

Former Member
0 Kudos

In the File adapter Receiver Communication Channel, I am using variable substitution.

The problem is that the first variable I use (userid) is being overwritten by the second variable (filenumber). How can I fix this problem?

File Name Scheme: %userid%_%filenumber%.xls

Target XML:

============

<?xml version="1.0" encoding="UTF-8"?>

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">

<Worksheet ss:Name="FileName">

<Table x:FullColumns="1" x:FullRows="1">

<Row>

<Cell><Data ss:Type="String">0209519</Data></Cell>

<Cell><Data ss:Type="String">32226v2 v1.1</Data></Cell>

</Row>

Variable Substitution:

=======================

userid payload:Workbook,1,Worksheet,1,Table,1,Row,1,Cell,1,Data,1

filenumber payload:Workbook,1,Worksheet,1,Table,1,Row,1,Cell,2,Data,1

Expected Output:

==============

0209519_32226v2 v1.1

Actual Output:

============

32226v2 v1.1_32226v2 v1.1

Thanks for your help.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

just check for extra spaces in your variable substitution in your reciver file comm channel in ID.......

then ask your basis guys to do a full CPACache refresh using PIDIRUSER..........then rerun your scenario....

Regards,

Rajeev Gupta

Former Member
0 Kudos

Thank you for all your suggestions. I decided to modify my target XML and concantinate all the fields into one string so I don't have to worry about the variables being overwritten in the variable substitution.

Target XML:

============

<?xml version="1.0" encoding="UTF-8"?>

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">

<Worksheet ss:Name="FileName">

<Table x:FullColumns="1" x:FullRows="1">

<Row>

<Cell><Data ss:Type="String">0209519_32226v2 v1.1</Data></Cell>

</Row>

Variable Substitution:

=======================

filename payload:Workbook,1,Worksheet,1,Table,1,Row,1,Cell,1,Data,1

Expected Output:

==============

0209519_32226v2 v1.1

Actual Output:

============

0209519_32226v2 v1.1

Shabarish_Nair
Active Contributor
0 Kudos

you should move from variable substitution to dynamic conf - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

JoelTrinidade
Active Contributor
0 Kudos

Hi Kristine,

Please check your mapping in the target structure

the field you are mapping to var1 in variable substitution is either blank or not getting generated in your output msg after msg mapping..........so just check in output msg whether your field is having value or not...........

Also i read somewhere that in some thread and i quote "don't use variable susbstitution use adapter specific identifiers they allow to se the filename in a much better way (in a mapping) and they work for all adapters in the same way "

Regards

joel

Former Member
0 Kudos

Hello Kristine,

Could you please check if the target XML you have posted in your question is the exact output of your message mapping? You can do this by doing a test from the message mapping itself.

My guess is the target payload that is actually getting generated might be something like this.

<Row>

<Cell><Data ss:Type="String">32226v2 v1.1</Data></Cell>

<Cell><Data ss:Type="String">32226v2 v1.1</Data></Cell>

</Row>

I might be wrong, but its worth the try