Data Conversion With Node Path Like InsertAndUpdateNode
Posted: April 10th, 2023, 6:34 pm
The data conversion services generally take in a value or set of values and return converted versions of those values. However, for when working with a dynamic list that contains values to be converted, could an option be added to provide a location/path instead of the value(s) to the data conversion services and have them replace the previous value exactly where it was found?
Essentially, it would work like the InsertAndUpdateNode service except that it converts the value of all the found nodes instead of replacing or adding a child node to them.
Example
Given a path like WorkData/GetRecords/Output/Result/CreatedDate, the ToDate service could just modify the value of every instance of CreatedDate found in GetRecords directly.
Reason
I have found myself in situations where I have lists of records and want to convert a value of each record. In those situations:
Essentially, it would work like the InsertAndUpdateNode service except that it converts the value of all the found nodes instead of replacing or adding a child node to them.
Example
Given a path like WorkData/GetRecords/Output/Result/CreatedDate, the ToDate service could just modify the value of every instance of CreatedDate found in GetRecords directly.
Reason
I have found myself in situations where I have lists of records and want to convert a value of each record. In those situations:
- Just converting the values gives me no way to determine where to put the converted value. The previous value is lost and any kind of record identifier cannot be included.
- Using a Loop to only work on a single record at a time makes it easier to accomplish, but that requires a few extra steps and the performance impact seems to quickly add up as that total number of records increases. It can also be quite inconvenient if needed in multiple locations as it cannot be made into a reusable method due to InsertAndUpdateLoopNode.
- By making it a single service, performance optimizations can be made to the service itself. For example, if there are duplicate values, then they can be replaced with the result of the first conversion instead of redoing the whole conversion again. This can be especially valuable if there are certain conversions that take a bit more time.