Skip to main content
Answer

If Statement Help for Commerce

  • February 9, 2024
  • 2 replies
  • 53 views

Forum|alt.badge.img

Hello!

I wanted to get some help with some code in the commerce connector. My client has a Shopify store with a connection to Amazon. All Amazon orders display a Tag of ‘Amazon’ in the Shopify Order Tags along with a few other tags that are autogenerated. I’m trying to import ‘Amazon’ to one of the Acumatica SO fields anytime ‘Amazon’ appears as a tag and leave the field blank if it does not. Here’s what I have some far, which worked once, but does not seem to work everytime.

=IIf(InStr([OrderData.Tags], 'Amazon') >0, 'Amazon', ' ')

Thanks in advance!

Best answer by Yuri Karpenko

@freddydelrio39 , I think this formula won’t work if Amazon tag is the first one in the list of tags.  Instead, you can use this:

=IIf(InStr([OrderData.Tags], 'Amazon') <> -1, 'Amazon', ' ')

-1 is what returned by the InStr formula where the value is not found.

LMK if this helped!

2 replies

Yuri Karpenko
Captain II
Forum|alt.badge.img+6
  • Captain II
  • Answer
  • February 9, 2024

@freddydelrio39 , I think this formula won’t work if Amazon tag is the first one in the list of tags.  Instead, you can use this:

=IIf(InStr([OrderData.Tags], 'Amazon') <> -1, 'Amazon', ' ')

-1 is what returned by the InStr formula where the value is not found.

LMK if this helped!


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • February 9, 2024

That worked! Thank you @Yuri Karpenko!