Concat function - how to add an apostrophe to a string?
How would you concatenate an apostrophe in front of a string?
Assume I wanted to produce the string 'Hi
= Concat('Hi','Hi') yields the string HiHi
= Concat(''','Hi') yields missing operator before the Hi operand message
The formulas use SQL syntax, so ' is used as the start and end character of a string. To make ' be a part of the string, you have to escape it with a second '. In short, you'd need this:
Thanks for responding.
That is one of the first things I tried, but I got a different result when I View the Inquiry.
I get ''Hi as a result (2 leading apostrophes).
Using Acumatica 2018 R2 with customizations.
Maybe that has something to do with it.
Maybe you are using a different version of SQL Server or MySQL?
Hey @robcushen, I had an idea on this over the weekend if the GI is still giving you problems with this.
I feel like you can use an Attribute to solve this. I made instructions on how to set up Attributes here: https://www.augforums.com/forums/postid/5761/
So, you can make an attribute and name it "CONSTANTS". The control type will be Combo. The value will be your key to looking up the constant, and the Description will be what you actually want to appear. In this case, I used "APOSTROPHE" as the Value ID and put in ' as the Description.
Next, add CSAttributeDetail to your GI. Add a relation to CSAttributeDetail to any table on CSAttributeDetail.AttributeID ='CONSTANTS' and CSAttributeDetail.ValueID = 'APOSTROPHE'. You should be able to use = Concat([CSAttributeDetail.Description],'Hi') to get a single apostrophe where you need.
In most engagements, I have full SQL server access & functionality. In that environment almost anything is possible!
I ended up going another route to get to a quick solution in this case. Thank you very much for providing this creative solution. It may well come in handy the next time I encounter a similar issue.