How to use underscores in an expression in Analytics Architect.
Hi community
I have a persistent data class where there are some properties that contain underscores in their names, for example:
Property "client_name" As %String(MAXLEN = 250) [ SqlFieldName = client_name ];
In Architect, I would like to use this property in an expression, in this field:.png)
But I can't figure it out. If I use %source.client_name, it gives a compilation error. If I use %source."client_name", it treats it as the string "client_name" instead of getting the value from the field. Any suggestions on how to do this?
Comments
In ObjectScript "_" is concatenation operator variable _ variable or for defining a name for data class MyPackage_User.Names. In you case the system tries to concatenate two fields. In case when you wrap it in double quotes it realy just became a string, that how syntax works for %source in Architect, you can not workaround it, i suggest you to just rename it without any delimiter if possible.
If you use any other data classes exclusively for SQL tables, delimited field will work just fine with double quotes.
Create a GetMethod to return the value of the property and use it in the expression.
Try using:
$property(%source,"client_name")
It didn't work. It shows an UNDEFINED error in the %source variable. It's strange, we imagine that %source is an object that stores the fields, but it isn't; we can't access the %source variable directly.
you can go for:
$property(%source.%PackageName()_"."_%source.%ClassName(),"client_name")Or just add a method in a cube class that does what you want and call it via:
%cube.YourMethod(%source.%Id())