cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping scenario with one customer and many invoices

Former Member
0 Kudos

Hi!

I am receiving a flat file with one customer and n-invoice records. The file could look like this:


133133222051241480320842420500089
13317350071000010806372131000                 0015890009876543X
13317350071000010806372131000                 0015890009876543X
13317350071000010806372131013                 0015890009876443X
13317350071000010806372131014                 0015890009872343X

where the first line is customer and the rest are invoices.

My question is: How can I get this into a structure like this:

<Customer>
  <...>
<Invoice>
  <...>
<Invoice>
  <...>

When using content conversion (Customer,1,Invoice,*) there has to be specified a key field, which is not a possibility. Do I have to create a UDF for this to get the mapping I want?

Thanks for your answers!

regs Ole Mugaas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solved by creating each line as its own invoice and have different keyfields for each of them. Then it could be connected to the main invoice.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ole,

Your first node is customer and then invoices records.

Means occurrence of 1st line is one and invoice is unbounded.

In this case you need to define the key field name and it's value in the file adapter.

Without keyfield you cannot conert this structure.

Thanks

Amitanshu

Former Member
0 Kudos

Thanks for your answers!

As I can see from the Krawcyk blog, he is only using one node and maybe that's why he don't have to use keyField. We have also come to the conclusion that we have to use keyfield, but then we have to give the fields out own values. This is not good enough since the values are predefined. Creating a "placeholder" in each data type would not be a good answer because then our customers have to send an additional field in the file which would cause a lot of work.

Do you know how this can be solved with the keyfield? Is it possible to create a keyField and give it a value that is already there, ex:

Invoice.keyFieldValue = Invoicenumber (where Invoicenumber is a field specified in the DT) ?

regards Ole

Former Member
0 Kudos

hey

are these files tab/space seprated of fixed lengths?

i mean is the length

133133222051241480320842420500089

13317350071000010806372131000 and all are fixed?

if yes,then just use .fieldFixedLengths parameter

thanx

ahmad

Former Member
0 Kudos

Hi!

Yes, they are fixed lengths. Still it does not solve the problem as the specification says there have to be a "key field" in the mapping as there can be more than one invoice record. The question is if there is a possibility to create this mapping without using the "key field" as I don't have any fields that have the same value in each record...

-Ole

Former Member
0 Kudos

hey

i dont find a reason why u want to use Key in ur scenario,

have a look at the following and see if it helps

/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter

thanx

ahmad

PL:Reward with points if helpful

Former Member
0 Kudos

I know. I have tried it several times but the communication channel gives me the error message

Mandatory parameter 'xml.keyfieldName': no value found

... And I don't know why... Any more suggestions...?

Former Member
0 Kudos

can u please send the sender dat type and the FCC parameters ur using(when u get the 'xml.keyfieldName' error

thanx

ahmad