Can I use two keys to join two schemas together?
I am using the key function to join two schemas together. Is it possible to use two keys as I have two schemas that are joined on two variables?
I have two schemas that are related to each other by two of the field names of each the two schemas.
For example, Schema 1 has two field names called batch name and date field. Schema 2 also have these fields names that match up to schema 1. I am trying to join the two schemas together on both the batch name field and the date field field together. Basically the data comes from both of the schemas where the condition of of both the batch name and the date field match.
In my scenario the key function is ideal because all the data is retrieved from schema 1 and merges the dataset from schema 2 when the key matches. In essence it is almost like a SQL left outer join. The unique thing about the key function in my data mapping is that the data from schema 1 and schema 2 are matched on two of the field names as opposed to just one.
-
First Approach with key function:
- Create a new key say as Batch Name and Apply below ForEach condition on the target Record level: "$keyBatchName[Date1 = $Input_Schema2/Root/Record/Date2]"
Second Approach without key function(More Feasible):
- Apply ForEach on target Record level: "$Input_Schema1/Root/Record[BatchName1 = $Input_Schema2/Root/Record/BatchName2 and Date1 = $Input_Schema2/Root/Record/Date2]"
NOTE: Date1 and BatchName1 are the fields of the first input source schema(Schema1). Date2 and BatchName2 are the fields of the second input source schema(Schema2).
0
Post is closed for comments.
Comments
1 comment