Question
BOA
US
Last activity: 15 Nov 2019 15:23 EST
How to Keep Table Headers when using ReplaceTable (keep column mapping)
Hi- I am using Pega Robotics and am creating a data table by deserializing a json string. I have been using this output and replacing another table which has defined column names- and this table is used many times in the automation. However the problem arises when the first table's columns come in a different order. Since the second table is being overwritten when being replaced, there is no column mapping.
Any suggestions for a more intelligent way to do this? We are expecting the JSON to come in un-ordered fashion.
Should I try to work out of the first table? When trying this, I have a proxy object and not as many options with it.
I would adjust the column order in the incoming DataTable before you replace the existing table with it. The LookupTable is required to be well-defined; essentially unchanging, so if you call ReplaceTable with a DataTable that doesn't match the format you've defined for the LookupTable, it won't work properly. This adjustment would require some C# as the DataTable is not a Pega-specific object.
I did a quick test and it seems as though the extra columns in a "different" table were just eliminated. If I had a table that was simply in a different order, it seems the order was preserved, however that may have just been the DataGridView doing that.