cancel
Showing results for 
Search instead for 
Did you mean: 

picking fileds randomly from the input file.

Former Member
0 Kudos

Hi

I have a input file like below. Each record contains abt 40 fields and file may contain abt 30000 records

12345abcde!@#$%45678.............

23456bcdef@#$%^34567.............

.................................................

....................30000(records).........

But my business rek is........... I have to pick only 10 fileds(not necessarly first 10 and not necessarly side by side) from each record. How can we achieve this ??

whether message protocol to be used is file or file content conversion ?? How to pick random fields from the input file ?? But I have the knowledge of each field length......!!

Thanks

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey

but why do u want to pick up only 10 fields?

sorry but i m unable to understand the requirement,if at a particular time u want only 10 fields,then whats the use of sending more than 10 fields,the sender system must send only fields that are relevant.

could you please explain the requirement

Thanx

Aamir

Former Member
0 Kudos

Basically we didn't have control on the file that third party people sends. So we got to pick the fields that we want from each record.

Former Member
0 Kudos

hey

well if u atleast know the position of the fields which u want to use,then map only those fields.

but in case u don't even know their position in XML structure,i guess its kinda impossible to design this scenario coz u will keep on getting mapping error coz the incoming file won't match the sender data structure.

Thanx

Aamir

0 Kudos

Hi,

What you can probably do is write a Random number generator UDF in your mapping, call it 10 times for each record and pick the char at that random number position from the file. Probably having a small piece of java code to do this would do good.

But, why do you have sucha requirement?

Thanks,

Karthik

Message was edited by:

Karthik Rangaraju

Former Member
0 Kudos

hey

this will only work if he knows the position of tags in the XML structure,if he doesn't then he will keep on getting message mapping error.

the requirement looks a bit off the way

Thanx

Aamir

Former Member
0 Kudos

so think of I know the position of the field that I have to pick up. Then how can i go in this case ?? I don't want to create all the fields in the source data structure ! Just I want to create only the fileds that are needed in the source data type ??

If I create all the fields in the source data type probably I can read all the fields of each record and can map whatever the fields that I want to to target strucutre ! But this is not my rek. I want to create only the fields that are needed in the source data structure and want to read only the required.

thanks

kumar

Former Member
0 Kudos

Hey

see here is the thing,assuming that u know the position of the fields you need.

now if u create ur data type based with only the fields you are concerned with,you will get error coz when u run the scenario,you will be getting more fields than the sender data type can handle.

so your source XML file must be exactly similar to the sender data type,an exception to this is a bypass scenario,but thats not gonna work out in ur case coz u don't want all the fields on the receiver side,you only need specific fields.

the solution is to create the sender type with all the fields you will be getting,but the receiver must have only the fields u actually need.do the mapping for only the fields u really need and leave the rest as it is on sender side.

moreover creating a data type with 40 fields is not much:)sometimes we have to deals with much more than this

Thanx

Message was edited by:

Aamir Suhail

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

What is on the receving side is it SAP and can you use proxy or trigger a RFC call then you can do that.

Moreover if you expect a solution from SDN explain where you are stuck, on what basis you are picking those 10 fields and how this will vary from row to row in the same file or from file to file basing on any factor from the source file, what is the controlling factor which tells these 10 fields need to be picked? do explain all these may be they can comeup with a better solution.

Regards,