Text Mode Search and Replace | Community
Skip to main content
Level 2
August 21, 2020
Question

Text Mode Search and Replace

  • August 21, 2020
  • 2 replies
  • 1218 views

I need to shorten the value of a field to the Value Field instead of the Label. I'm trying to get this conditional to work but it seems to be failing. Is there a better way to do a string replace?

valueexpression=IF({project}.{DE:Deliverable Aspect Ratio} = 'HD - 16:9 - 1920 x 1080', 'HD', IF({project}.{DE:Deliverable Aspect Ratio}='Square - 1:1 - 1080 x 1080', 'SQ','null'),'null')

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

imgrund
Adobe Employee
Adobe Employee
August 25, 2020

Hi - I've never put null in an IF statement. I tend to use two quotation marks with no space. (Also you have a lot of spaces in there. I've removed the unnecessary ones)

valueexpression=IF({project}.{DE:Deliverable Aspect Ratio}="HD - 16:9 - 1920 x 1080","HD",IF({project}.{DE:Deliverable Aspect Ratio}="Square - 1:1 - 1080 x 1080","SQ",""),"")

ByronNa1Author
Level 2
August 25, 2020

Thanks @Anthony Imgrund‚ . I always forget about the spaces, I typically add them in out of habit and for legibility's sake. I put those "null" strings in as placeholders. I'll need to add a bunch more conditionals to cover all the options coming into this field. I'm guessing there isn't a better way to do it that I'm approaching. That was my question.

imgrund
Adobe Employee
Adobe Employee
August 25, 2020

Gotcha! Yeah, when you have long complicated one it can seem tedious. What has helped for me is do them as separate IF statements and then start combining them from the bottom up and replacing the TRUE or FALSE section (depending on your needs)

Start with

IF({project}.{DE:Deliverable Aspect Ratio}="HD - 16:9 - 1920 x 1080","HD",FALSE)

IF({project}.{DE:Deliverable Aspect Ratio}="Square - 1:1 - 1080 x 1080","SQ",FALSE)

IF({project}.{DE:Deliverable Aspect Ratio}="Other","Other",FALSE)

Then have

IF({project}.{DE:Deliverable Aspect Ratio}="HD - 16:9 - 1920 x 1080","HD",FALSE)

IF({project}.{DE:Deliverable Aspect Ratio}="Square - 1:1 - 1080 x 1080","SQ",IF({project}.{DE:Deliverable Aspect Ratio}="Other","Other",FALSE))

Finally

IF({project}.{DE:Deliverable Aspect Ratio}="HD - 16:9 - 1920 x 1080","HD",IF({project}.{DE:Deliverable Aspect Ratio}="Square - 1:1 - 1080 x 1080","SQ",IF({project}.{DE:Deliverable Aspect Ratio}="Other","Other",FALSE)))

Hope that helps

ByronNa1Author
Level 2
August 27, 2020

Still coming up blank. Could it be that this field is from a check box and the user is allowed to check more than one option? Maybe the conditional is looking for the entire result to match one of the options? But if there are more than one checked it throws it off?