cancel
Showing results for 
Search instead for 
Did you mean: 

Determine output filename based on input filename content with RFC lookup

nkr1shna
Contributor
0 Kudos

Hello Guys,

I have this sitaution which needs your ideas/sugestion.

1) PI system picks up text file from FTP server folders.

2) Within PI system, we need to dynamically determine output filename , logic to determine output filename will be :

2a) Read content of the input file particular line number (Fixed)

2b) Pass the value got from step 2a) to the Remote function module passing value read in step 2a) to get response

2c) Use response received from 2b) to construct output filename.

Please let me know if you have any qeustions on my problem, appreciate your ideas/suggestions.

Thanks,

Krishna

Accepted Solutions (1)

Accepted Solutions (1)

PriyankaAnagani
Active Contributor
0 Kudos

Hi Nagendra,

>>>>>Read content of the input file particular line number (Fixed)

Let us say If you want to read some FieldA from line 5 , then read the 5th value from the input queue of FiledA...use CopyValueOf function to read the 5th value and pass it as input to RFClookup and get response and pass the response as input to UDF where you'll construct target filename & implement Dynamic configuration .

Regards

Priyanka

Former Member
0 Kudos

I agree with Priyanka's solution approach.

1- You can use CopyValueOf function to read the <InputFieldValue>

2- Pass the <InputFieldValue> to RFClookup and get response

3- Pass the RFC's response as input to an UDF to construct the FileName (you can refer to this blog article /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 ) .

nkr1shna
Contributor
0 Kudos

Hi Priyanka,

Thanks for answering my qeustion, Appreciate your suggestion.

I will try out your suggestion and come back on my test results.

Best Regards,

Krishna

nkr1shna
Contributor
0 Kudos

Hello,

Sorry for the delay in responding back. Now I am trying to use CopyValueOf function in the graphical editor.

My input file name has values and second line starts with :25:24803501

Where in I want to copy 24893501, I want to use parameters to be passed to CopyValueOf function.

Appreciate your response.

Regards

Krishna

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

You can try this logic....

str.substring(str.lastIndexOf(':')+1,str.length());

where str = :25:24803501

Thanks

Priyanka

nkr1shna
Contributor
0 Kudos

Hello Priyanka,

THanks for your response to my post.

My input TEXT filename has following contents

:20:CHASGB2LXXX

:25:24803501

:28:11264/01

:60F:C110921USD85410,88

:61:110921C12307,00NTR NONREF//5311802

:86:TR ?

?20IV.2000199238 FR.26.08.11 IV.2000198595FR.22.08.11

?23AZMAT20091123183

Now I would like to read second row of this TEXT file containing ":25:24803501" and would like to read only text

24803501.

Hope this additional info will provide me more info on my requirement. Appreciate your response.

Regards

Krishna

Former Member
0 Kudos

Use CopyValue Function to read Second Position of File

For a frequently occurring element, copies the value at a defined position in the source structure to the assigned target field.

Then, use substring function to get Number with parameters:

Startindex = 3

Endindex = <LenghtOfCode>

Example -> String = 25:123456

Start = 3

End = 9

nkr1shna
Contributor
0 Kudos

Hello,

Can I pass my input TEXT filename to the function CopyValueOf and read second row and required position in the file?.

May I request the parameters to be passed to get the function CopyValueOf, appreciate if you can provide me an

example usage of CopyValueOf when passing filename as input.

Best Regards

Krishna

PriyankaAnagani
Active Contributor
0 Kudos

Hi Nagendra,

>>>>>Can I pass my input TEXT filename to the function CopyValueOf and read second row and required position in the file..

Do you want the file name or file content? Copy value of function cann't read the file content if we give the filename. Using file content conversion read the data in the file into source structure and then from the source structure pass the fileld that you want as input to the copyValueOf function. Lets say if the source field Field1 has 10 values in the input queue, and if you specify the function property as 3 then it'll just copy the 3rd value from the input queue to the result queue.

Thanks

Priyanka

nkr1shna
Contributor
0 Kudos

Hello Priyanka,

You are right I am going to use File Content Conversion technique to read input TEXT file and then will use CopyValue function to read the specified row in the input file and then pass on to the RFCLookup function.

Thanks & my appreciation for everyone who answered my question.

Best Regards,

Krishna

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

in your case, you will need to do a RFC lookup and based on the response do a dynamic configuration for the output file name.

It will remain as the standard way of doing it with the only additional logic that you will have to do a RFC lookup and then proceed with the response of that to create the file name.

ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name