Hello, is there any way to save a calculated field by expr in database?
When I create a calcualted attribute, it's only saved as XML and not as a database record. I want to keep them after being calculated, so I can make an index. Is there any way?
Solved! Go to Solution.
Views
Replies
Total Likes
I finally did it creating a Trigger with an SQL Code, all the other options wouldn't create an SQL column
Hello,
You can create a dedicated field in the schema and then you can either
Views
Replies
Total Likes
How could I do the second option?upon writting a record, calculate the field and store it
Views
Replies
Total Likes
Could you provide more information on the schema you have the calculated field and which expression are you using?
Thanks
Views
Replies
Total Likes
You can use the below code as an example to create a calculated field and insert in the schema.
var UUID=getUUID();
logInfo("UUID = "+UUID);
sqlExec("insert into CusSequenceTest( sEmail ) values ('"+UUID+"');");
Regards
Akshay
Views
Replies
Total Likes
Hi @CampaignerForLife ,
You can create the Index directly on the Calculated attribute as shown below
For Example, consider you have created the Calculated field on @email , then you can use the below syntax as an example for Calculating the length of this field.
<attribute desc="Test calc field" expr="Length(@email)" label="EMAIL_TST" name="tstEmail"
type="string"/>
and then create the Index in the Schema as shown below:
<dbindex name="PK_TstEmail12" unique="true">
<keyfield xpath="@tstEmail"/>
</dbindex>
It will allow you to create the index on this calculated field.
Also you can try Updating the Values into the Schema by using sqlExec command using the workflow.
Regards,
Pravallika.
Views
Replies
Total Likes
I finally did it creating a Trigger with an SQL Code, all the other options wouldn't create an SQL column
Views
Likes
Replies
Views
Likes
Replies