cancel
Showing results for 
Search instead for 
Did you mean: 

PI / HCI useOneAsMany mapping question

former_member207428
Participant
0 Kudos

Hello everyone,

let's say we have following node structure :

/compoundemployee/person/employment_information -> 0:1 records

    custom_string1

    end_date

    start_date

    user_id

    ...

/compoundemployee/person/personal_information -> 0:n records

      end_date

      start_date

      ....

Question:

For selection of personal_information, personal_information/start_date needs to be >= employment_information/start_date <= personal_information/end_date.

I tried the mapping below, but for attached test data I get for person_id 2714 the personal_information from 2810. For 2810 I get the personal_information from 2830. There seems to be some context issue, but can't exactly point out why.

The personal_information/end_date value can be null, so I have added 'mapWithDefault'. To keep the queue consistent, I have added 'mapWithDefault' to personal_information in 'useOneAsMany', as i.e person_id 20 has no personal_information.

The context of employment_information/start_date below is changed to /person, this is a 0:1.

Test data attached :

  • the used xsd file
  • xml file with sample data
  • person_id's with no or multiple personal_information records are 20, 2090, 2112, 2173, 2490, 2510, 2671, 2714, 2791, 2810

   

Any clue?

Thanks again, appreciated -

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Kevin,

Use below mapping.start_date and end_date from personal_information context should be person.

Regards,

Praveen.

former_member207428
Participant
0 Kudos

Hi Praveen,

thanks for the suggestion. I tried the mapping, but still end up with 'Brad Pitt' for person_id 2710 as in the screenshot earlier.

Context of /queryCompoundEmployeeResponse/CompoundEmployee/person/employment_information/start_date is also set to person.

Thanks again & best regards,

Kevin

former_member182412
Active Contributor
0 Kudos

Hi Kevin,

Use below mapping.

Regards,

Praveen.

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Kevin,

You need to maintain consistent context. Please see the mapping below:

personal_information/startdate and personal_information/enddate context should be set

to person. That way there is no need to use format by example. Please let me know if the output is correct

Regards,

Mark

former_member207428
Participant
0 Kudos

Hi Mark,

With context of all start_date and end_date's set to context person, I get following output for person 2710. As you can see on the left the entries do not match?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Kevin,

Yes, that is somewhat expected. Can you give the mapping logic for the other fields under personal information please?

Regards,

Mark

former_member207428
Participant
0 Kudos

Hello Mark,

all fields below personal_information are mapped in a 1:1 relationship.

Thanks for the help & best regards

Kevin

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Kevin,

I found a bug in the mapping. What you want is the true value to be always the first value in the context. Do it like this:

personal_information

lastname and preferred name context should be set to person

startdate/enddate logic

mapping test

Regards,

Mark

former_member182412
Active Contributor
0 Kudos

Hi Mark,

Check my response below no need to do the mapping for each and every field under the node.

Regards,

Praveen.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Praveen,

That was my initial mapping. But when I display queue, the output is correct. Test tab shifts the output by 4 employees when using 1..1 mapping that is why I said there is a bug. I'm using 7.11 SP13 by the way.

Regards,

MArk

former_member182412
Active Contributor
0 Kudos

Hi Mark,

I am saying my latest reply, the mapping is below. Try this one without mapWithDefault after personal_information node to useOneAsMany function.

Regards,

Praveen.

former_member207428
Participant
0 Kudos

Hi Mark,

thanks again for your response.

Well, using XSLT I already sorted the employment_information nodes by start_date, and selected the first. Something I forgot to mention. Your sortByKey is a good alternative.

Thanks!

Kevin

former_member207428
Participant
0 Kudos

The difference between you and Praveen's solution is the 'mapWithDefault' on the /queryCompoundEmployeeResponse/CompoundEmployee/person/personal_information/start_date, which I overlooked too.

Thanks Mark !