How to Compare two Object?
Comments
-
Hi,
[color=rgb(34, 34, 34)][font=tahoma, sans-serif]Is there a way to compare to object to see if the properties are different? Im working on a DW load flow and would love to be able to look at an incoming record and compare it to the record, if one exists, in the DW to see if all the fields match and return a boolean (or some other useful value). Is there a step for that?[/font][/color]
[color=rgb(34, 34, 34)][font=tahoma, sans-serif]
[/font][/color]
[color=rgb(34, 34, 34)][font=tahoma, sans-serif]Thanks[/font][/color]
[i]edited by Moshe on 7/2/2019[/i] -
Hello,
[color=rgb(34, 34, 34)][font=Arial, Helvetica, sans-serif]We have a step called Compare Two Objects. This step compares the properties of two different objects. However, the step does not output a boolean value. If you want a boolean value and check if all the properties of entities match or not then using a simple rule will solve your problem. [/font][/color]
[color=rgb(34, 34, 34)][font=Arial, Helvetica, sans-serif]
[/font][/color][color=rgb(34, 34, 34)][font=Arial, Helvetica, sans-serif]You can also use Boolean ReferenceEquals(System.Object, System.Object)(Method) step under Integration > .Net Libraries > System > Object (Class). This step compares two objects and returns a boolean value. I think this is what you are looking for.[/font][/color]
[color=rgb(34, 34, 34)][font=Arial, Helvetica, sans-serif]
[/font][/color]
[color=rgb(34, 34, 34)][font=Arial, Helvetica, sans-serif]Regards[/font][/color] -
This .net step seems to be the underlying step for the Object Are Equal step.
If I pass in the SAME object to this I get a true.
If I pass in two different objects, which were generated with the SAME step and the SAME starting data, this returns a false.
am I missing something here?
The objects I have tried for testing this are manually created data pairs with create data, and dynamic objects generated from an XML string.
Eg. from debugger results with the data pairs.
{ INPUTS: { objA: { Name: "FieldName", OutputValue: null }, objB: { Name: "FieldName", OutputValue: null } }, OUTPUTS: [ { path: "False", data: {} } ] }
This makes no sense to me.
-
Hello Haim,
We have a step where we can compare two objects. I have pasted the URL for the documentation.
https://documentation.decisions.com/step-library/docs/compare-two-objects?highlight=compare%20object
-
Yes, I also tried this step. It doesn't work as one would expect it to.
With dynamic objects built from two XMLs it ALWAYS returns true, with no values in the output.
-
Hey Haim, we would like to have your email address so that we can have a zoom call on this issue so that we can take a look where exactly you are facing the issue.
-
hca@appension.dk
Central European Time
Howdy, Stranger!
Categories
- 4.1K All Categories
- 61 General
- 11 Training
- 201 Installation / Setup
- 1.1K Flows
- 106 Rules
- 260 Administration
- 212 Portal
- 489 General Q & A
- 693 Forms
- 333 Reports
- 3 Designer Extensions
- 47 Example Flows
- 51 CSS Examples
- 1 Diagram Tile
- 7 Javascript Controls
- 178 Pages
- 5 Process Mining
- New Features
- 178 Datastructures
- 69 Repository
- 219 Integrations
- 28 Multi-Tenant
- 27 SDK
- 76 Modules
- 56 Settings
- 25 Active Directory
- 12 Version 7
- 35 Version 8
- 66 Lunch And Learn Questions