cancel
Showing results for 
Search instead for 
Did you mean: 

Value mapping replication operations in sequense

former_member190293
Active Contributor
0 Kudos

Hi Gurus!

I want to make a scenario for VMG replication from .csv files to runtime java cache.

As you know in request message we can have multiple "Item" elements with separate "Operation" value inside it.

My question is: if I set "Delete" operation for context in first element and set multiple "Insert" operations for further "Item" elements - is this sequense preserved during my request processing at receiver side? Or I need to perform multiple requests in sequense?

Regards, Evgeniy.

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hello Evgeniy,

Yes this is preserved.I just tried this on my server. Results as below

Scenario: Delete Operation Followed by Insert Operation

Results: Insert Operation is available as per sequence

As-Is Situation

New Request with Delete and Insert operation

Updated Value Mapping with Inserted Value

My question though: If you plan to update an existing entry, you do not need a explicit Delete. Just use Insert and it updates the existing entry.

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Additional Scenario: Insert Operation After Delete Operation

Result : Delete Operation takes precedence and value is removed.

former_member190293
Active Contributor
0 Kudos

Hi Bhavesh!

Thanks for your valuable answers!

I want to update contexts in a whole. Each of my files belongs to its own context so, when file gets updated, I just completely remove that context from java cache and than insert new values.

Regards, Evgeniy.

bhavesh_kantilal
Active Contributor
0 Kudos

Even easier then

All you need to do is , delete the Entire Group and then provide your new Group Entries.

See below example,


The above will delete your Group and then re-create it with the new Entries as your need it!

Regards,

Bhavesh

former_member190293
Active Contributor
0 Kudos

Maybe I didn't catch the basics in VMG concept 🙂

My file looks like:

U1 = 220

V1 = 112

...

and another file looks like:

CDB10004567 = 34543456

V100009998 = 12224535

...

and the third looks like:

V1 = 2114

U1 = 2907

...

So as I understand my VMG's should look like :

<GroupID>

Agency = "System1" Scheme="Scheme1" Value = "U1"

Agency = "System2" Scheme="Scheme2" Value = "220"

<GroupID>

Agency = "System1" Scheme="Scheme1" Value = "V1"

Agency = "System2" Scheme="Scheme2" Value = "112"

....

And so on. Or I'm getting wrong and it could look like:

<GroupID>

Agency = "System1" Scheme="Scheme1" Value = "U1"

Agency = "System2" Scheme="Scheme2" Value = "220"

Agency = "System1" Scheme="Scheme1" Value = "V1"

Agency = "System2" Scheme="Scheme2" Value = "112"

?

Regards, Evgeniy

bhavesh_kantilal
Active Contributor
0 Kudos

Evgeniy,

I now understand where you are coming from. You are using the more classical approach to Value Mapping.  I use this approach of ValueMapping :

If you go through this blog, you will understand that,

  • All Key Pairs for a particular set of Business Context are stored in One Value Map Group ( Eg: EmpID , EmpName Mapping is one Value Mapping Group ).
  • This is then accessed using a UDF. Standard Value Mapping Function would not work.

So, taking this into account, When I perform my value mapping replication my request will take

FieldValueExplanation
Group IDfe9ffaa0494211dea47b001e372d2d65Unique per Key-Pair Group
Contexthttp://test.com/xi/VMGGroup1Unique per Key-Pair Group
AgencyEmpID_EmpNameUnique per Key-Pair Group
SchemeEmp,2,3Keys
IdentifierEmpName,Bhavesh,JohnValues

Sample XML Request



<sys:ValueMappingReplication>

         <!--1 or more repetitions:-->

         <Item>

            <Operation>Insert</Operation>

            <!--Optional:-->

            <GroupID>fe9ffaa0494211dea47b001e372d2d65</GroupID>

            <Context>http://test.com/xi/VMGGroup1</Context>

            <!--Optional:-->

            <Identifier scheme="EmpID" agency="EmpID_EmpName">EmpName</Identifier>

         </Item>

           <Item>

            <Operation>Insert</Operation>

            <!--Optional:-->

            <GroupID>fe9ffaa0494211dea47b001e372d2d65</GroupID>

            <Context>http://test.com/xi/VMGGroup1</Context>

            <!--Optional:-->

            <Identifier scheme="2" agency="EmpID_EmpName">Bhavesh</Identifier>

         </Item>

      

        

           <Item>

            <Operation>Insert</Operation>

            <!--Optional:-->

            <GroupID>fe9ffaa0494211dea47b001e372d2d65</GroupID>

            <Context>http://test.com/xi/VMGGroup1</Context>

            <!--Optional:-->

            <Identifier scheme="3" agency="EmpID_EmpName">John</Identifier>

         </Item>

      </sys:ValueMappingReplication>

If you look at this example,

- Only Scheme and corresponding Identifier is different.

Data Stored in ValueMappingCache


How do I access this in Graphical Mapping


Use the Below UDF. inputKey is the Input to the UDF.


IFIdentifier source = XIVMFactory.newIdentifier("http:/"+"/test.com/xi/VMGGroup1","EmpID_EmpName","EmpID");

IFIdentifier target = XIVMFactory.newIdentifier("http:/"+"/test.com/xi/VMGGroup1","EmpID_EmpName",inputKey);

IFRequest request = XIVMFactory.newRequest(source,target,"EmpName");

AbstractTrace trace = container.getTrace();

String value ="";

try{

  IFResponse response = XIVMService.executeMapping(request);

  if (response.countTargetValues() > 0){

    String[] targetValues = response.getTargetValues();

    trace.addWarning(targetValues[0]);  

// take first value of result

   value = targetValues[0];

    }

  }

catch(Exception e){

}

return value;

So when my UDF has input as

  • 2, output is "Bhavesh"
  • 3, output is "John"

When a new set of values needs to be uploaded, Delete Old Group as per my previous response and then insert new entries!

Hope this makes sense

PS : Due credit to my Friend / Colleague who took time to enlighten me on this approach and wrote the above blog after some prodding!

Regards,

Bhavesh

former_member190293
Active Contributor
0 Kudos

Thank you very much for your help, Bhavesh! I'll try it this way after I finish with java code for merging VM data from multiple text attachments ☺

Thanks again for spending your time on helping me with this.

Regards, Evgeniy.

Answers (1)

Answers (1)

former_member194786
Active Contributor
0 Kudos

Hi Evgeniy,

Using multi-mapping with option to maintain order at runtime will do the trick. Although I was trying to find the option in iFlow and could not locate it. It is available in ICO though.

Regards,

Sajneev