Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.

Is it possible to typecast the datatype in profile query language?

Avatar

Level 3

Documentation do not cover typecasting the data for primitive types (double to integer)

https://experienceleague.adobe.com/docs/experience-platform/segmentation/pql/arithmetic-functions.ht...

 

Can we typecast the profile data in PQL API query approach?

 

For example: Let's say profile has an attribute 'memberShipDuration': '500' , it is a string type. Now in profile query API, would like to convert it to integer so we can divide by 12 to find the number of years.

 

profile.memberShipDuration/12 = 41

2 Replies

Avatar

Employee

Hi @ShashiCh ,

PQL does not offer a cast operator like toInteger currently.

The best way to get the operator working is to add a new field of integer datatype to the schema and populate the dataset with relevant integer values. Then perform the arithmetic operation on this newly added field.

Thanks!

Avatar

Employee

@ShashiCh Did you find the suggested solutions helpful? It would be great if you can  mark the answer as correct for posterity. If you have found out solution yourself, share it with wider audience in the community.