Jump to content

Strange inconsistency with text field value matching... bug?


This topic is 2231 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey all,

I'm trying to debug a de-duping script I have which runs after importing records. The script works by sorting the imported list by a match field, iterating through the found set and marking any record with the same match field ID as the previous as a duplicate. It mostly is working fine except in this one case which has me stumped as the values of the strings in each comparison are different but the condition tests "true". In the following code example when I run a comparison on the a1 and b1 derived values, c returns "1". If I use the static a2 and b2 values, the condition tests "false" (as expected). I have checked the derived b1/b2 values in the data viewer and confirmed they are identical to the a2/b2 values. Any idea what might be happening here?

 

Let([

a1 = "DgP5cPJYR"; // static match string A
a2 = $id; // resolves to "DgP5cPJYR" 

b1 = "DG5GvtJlR"; // static match string B
b2 = GetField(Get(LayoutTableName) & "::" & $matchField); // resolves to "DG5GvtJlR"

c = If ( a1 = b1 ; 1 ; 0 )];
//c = If ( a2 = b2 ; 1 ; 0 )];

a1 & ¶ & b1 & ¶ & c
//a2 & ¶ & b2 & ¶ & c
)
a1 & ¶ & b1 & ¶ & c
returns...

DgP5cPJYR
DG5GvtJlR
1

and...
a2 & ¶ & b2 & ¶ & c
returns...

DgP5cPJYR
DG5GvtJlR
0

This has got me stumped I have to say... any help appreciated.

 

Link to comment
Share on other sites

Thanks for replies.

I checked the values in a text editor and they're identical (no BOMs, VTs or other hidden chars).

Quote

No, it doesn't:

Apologies, I cleaned up the expression to post and made a typo so posted the opposite results to what I'm seeing. In fact the dynamically referenced comparison is returning true and the static false (expected result). Have attached both evaluated results below.

I've worked around it using the Exact(text1 ; text2) function which is clearly a more robust coding practice but still curious why the comparison using the "=" operator worked for 7 out of 8 non-identical comparisons with strings of this format except these two values..?

static.png

dynamic.png

Link to comment
Share on other sites

I am not able to reproduce your result.

1. What do you get if you simplify your expression to:

Let ([
a2 = "DgP5cPJYR" ;
b2 = YourTable::Yourfield ;
c = a2 = b2
];
a2 & ¶ & b2 & ¶ & c
)

2. What is the type of the field referenced in b2?

 

Link to comment
Share on other sites

This topic is 2231 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.