Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

 

Check carefully for trailing spaces and/or extra carriage returns....

1 hour ago, mattp52 said:

In the following code example when I run a comparison on the a1 and b1 derived values, c returns "1".

No, it doesn't:

dg.png

  • Author

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

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?

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.