Typecasting Between Design and Flows / Data Stores / Server Actions

@patrick, you have got me thinking about typecasting.

For those of you not familiar with my post today, I had a problem with access to a Data Store working in one situation and not another:

This code worked (was within a repeat block):

<p dmx-on:click="all_contacts.update({id: id},{first_name: 'Jane'})">update ({{id}})</p>

And this didn’t (was within a form):

<p dmx-on:click="all_contacts.update({id: h_contact_id.value},{first_name: 'Jane'})">update ({{h_contact_id.value}})</p>

And @patrick’s response was:

My guess is that h_contact_id.value is a string and id is a number, try using h_contact_id.value.toNumber() .

Which fixed it!

So on to typecasting…

With the link to/from Server Actions we can be very loose about specifying the type, and clearly that isn’t the same with the link to the Data Store, and maybe Flows too.

So @patrick, would you recommend that:

  1. We just get stricter in our designs.

  2. We make more of the data types in a Data Store or Flow parameters of type text (but will that stop number/boolean based functions working inside those items?)

  3. That Wappler does something to Data Store and Flows like you may have already done to Server Actions to make them less type sensitive?

I appreciate that with SA we are linking to PHP, and with F/DS we are linking to Javascript… and I’m not familiar with how type strict they are (hence my use of Wappler… :thinking:)

Would appreciate your views and a general discussion here on the forum! :slight_smile:

Best wishes,
Antony.

Community Page
Last updated: