a simple sql question

a simple sql question

  


Hi everyone, i want to ask a simple question,

I go two entities .


And i create a food order page 

A Form is in it, it require user to fill in name of Food and it's amount <-- this two is in FOOD Entity

And the last one is the name of show <-- in Shop Entity ,


When i press OK 


HOPEFULLY can update the food name, food amount and SHOP id to the Food entity,

so i add a sql commond 

 SELETE {shop}.[id] FROM {shop} WHERE {shop}.[name]=FoodForm.Record.Shop.Name 

 INNER JOIN {food} on {shop}.[id]={food}.[shopID]

t it not working, May i ask how to solve it? 

Thank you


Hi Eva,

This is not the standard way of doing this.

THe standard way is: 

Replace the input for the Shop by a combo box. If you delete the label + input and drag the ShopId attribute and drop it into the form, it should create the combo box automatically.

This way, you don't need the SQL (that shouldn't be used when an aggregate does the work).

Than you just use the form record as source to the CreateOrUpdateFood entity action and you're done.

Cheers.

Hi eva wong, 

First thing I noticed above is, there is no name attribute in shop entity. So your SQL statement on that basis is wrong.

Secondly, if you want user to choose the shop from dropdown and update food entity , you can just create GetShops  aggregate in the preparation of the page and use it as source for a combo box. In the combo box, set Variable as Form.Record.Food.ShopId , Source Record as GetShops.List and source attribute as whatever you want to display to users. Now when user clicks save, just perform create or update action.

HI ,Syed Zaheer Basha .

Sorry for the mistake i have add name to the shop entity

And I follow your step 



Here is my food preparation


But on the Food Page it still can't show which shop for the food 

Thank you 




Hi eva wong, 

First thing I noticed above is, there is no name attribute in shop entity. So your SQL statement on that basis is wrong.

Secondly, if you want user to choose the shop from dropdown and update food entity , you can just create GetShops  aggregate in the preparation of the page and use it as source for a combo box. In the combo box, set Variable as Form.Record.Food.ShopId , Source Record as GetShops.List and source attribute as whatever you want to display to users. Now when user clicks save, just perform create or update action.



Hi eva wong,

In support to the above comment I have created a demo application as per you requirement. Please check the attached module for ideas.

Demo Link

Hope it helps.

Let me know if you have any questions!


Kind Regards,

Benjith Sam

Benjith Sam wrote:

Thanks Benjith,

That's help a lot


Hi eva wong,

In support to the above comment I have created a demo application as per you requirement. Please check the attached module for ideas.

Demo Link

Hope it helps.

Let me know if you have any questions!


Kind Regards,

Benjith Sam



Hi eva wong,

The action on clicking ok  button should be like this : (you can also end the flow with END)


The combo box should be like this : 

You should have GetShops in your preparation.