How to assign one entity with identifier type
Question

Hello All,
I want to ask simple question..
So i have switch widget here..

It is using local variable named BooleanVar, and what i want to do when the user press save, in the logic i would like to assign the "DriverId" . Here i already put the variable, but for the value i really confused , what should i put there if i want set the value is Driver.Id = 3 or No Driver. 

 


Thanks guys,
Best Regards,
Ran

Hi,

On button click, based on your local variable(BooleanVar) You can fill DriverId list attribute.

You can use If widget and this widget you can check BooleanVar value if True then you can assign DriverId =1 Else DriverId =3.


Thanks

Vinod

Hi vinod, thanks for replying me, it would help me a lot !
Really appreciated it !

Hi Bhetrand,

Beside using If widget as Vinod mentioned above, you can use If() function as well.

For example you can use this for Value: If(BooleanVar = True, 1, 3).

However, please note that to make sure data consistency, you need to get list of driver and filter it as requirement then use that Id to assign. Because hardcode the Id may cause error in other environments (QA or Prod) as Id may different. If the list driver is fixed mean no change then you can convert Driver entity to static entity then easily assign value.

Regards,

Khuong

Hi Khuong, nice to see you again!
Thanks for replying me, it would help me a lot !
Really appreciated it !

Hi Bhetrand,

this is slightly besides your question, but I think the better design choice would be to make driver reference attribute not mandatory on your booking, and if switch is false, just set driverId as NullIdentifier().  Instead of assigning some random driver number the title 'No Driver'.

Another question i have : if switch is true, you still have to invent some logic to decide which one of your drivers to assign, how will that be done ?

Dorine

Hi Dorine, thanks for the solution. Actually i have some reason why i create like that :D
For answering your question, actually i already have some screen that have feature to assign the drivers ..

Anyway, thankyou for replying me!
I really really appreciated it ! Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.