/ Development  

Secrets revealed; An extra addition on the "advanced expressions" post two years ago

Hi there AppWorks fans,

Welcome to a new installment of AppWorks tips.

Two years ago, I published a great post about the usable expressions in conditions and the different functions available. That post included a deep dive on specific use-cases usable for your solutions. Only, one function is missing in action here which brings the greatest value of all, but also missed from my side in that time #RTFM; We’re talking year 2022; maybe undocumented back then!? Have a look at the post on the forum…Have a read; It will blow your mind and triggered this post.


Let get right into it…

As smart low-code developer on AppWorks, you need to learn how to use the documentation delivered with the platform. Sometimes it’s immensely helpful, sometimes it sends you into an unexpected direction (wrong or right), sometimes it’s wrongly documented, and something it’s not even documented. Don’t blame the messenger here, but I’m talking specifically about a section of the low-code developer guide of the AppWorks platform everyone requires to know the existence:

tostring_001

What exactly did we miss in the post from 2022? A valuable function! And why is it all so important suddenly? That’s because this function solved me a headache for a customer implementation where I thought it was a mission impossible to implement.

Let’s say you have a ‘toMany’ relation BB from one entity ‘Case’ to another ‘User’ (of the identity package) and want to know if it (an array!) contains a specific value from a different property. So, like these expressions:

1
2
3
4
5
6
{("hello;in;my;array;world").split(';').contains('my')} 
//Gives TRUE
{(item.to_many_user[].Properties.Name).contains('awdev@awp')}
//Gives TRUE when I relate to own account
{(item.to_many_user[].Properties.Name).contains(item.Properties.case_name)}
//Gives TRUE when I relate to own account and give the case name temporarily my account as the case name

Nice, but sometimes you also want to know the values within the array for further investigation or validation on your correctness…That, my friend, is the power of the toString(...) function! And it all looks like this:

{(item.to_many_user[].Properties.Name).toString(';')}

Ohw, and down forget all the extra parentheses (...).toString(';')!

I use a temporary email template to validate the outcome in runtime…With this in design time:

tostring_002

We’ll see this in runtime:

tostring_003

That’s a party! As with this information we can now also further investigate our ‘Rule’ BBs when we hit the wall of blindness designing advanced conditions! And don’t tell me you never asked yourself why on earth the conditions is not working while you’re sure it is correct, but after endless checking you come to the conclusion you check a wrong property or a wrong case-sensitivity! Well, now can see the real values when using arrays/lists.

Comment me if you have a separate way to quickly validate the result of your expressions!?


A valuable “DONE”. Share it with the world before it’s all too late on the workarounds of missing this feature. Have a great weekend. Over and out! 🧐

Don’t forget to subscribe to get updates on the activities happening on this site. Have you noticed the quiz where you find out if you are also “The AppWorks guy”?