Greetings, I'm currently making a logic to prevent user from inputting Sales Quantity more than Available Quantity (Sales Quantity < Available Quantity),but I think I missed something on my IF statement because it always goes for the FALSE statement which is "The amount of Sales Quantity that user inputted exceed the limit which is the Available Quantity" (Sales Quantity > Available Quantity)for exp:Sale Quantity = 100 and Available Quantity = 122 then -------> IF Statement -----> False StatementWhat should i do to fix it (I already make the IF statement Sales Quantity < Available Quantity but still cant work) ? Sorry for my EnglishThanks
Hello Denise,
You are trying to retrieve stock data from GeSalesByID aggregate, but since you are adding a new item there is no Id, thereby data is not retrieved for Stock.
To implement such validation, I would add another aggregate to the screen: GetAvailableStock with filter (Stock.Id = GetSaleById.List.Current.Sales.StockId --> selected stock type id by user), then inside the add action i would refresh the GetAvailableStock and check if requested quantity is more than or equal available quantity.I have attached sample logic, I hope this will help you
Greetings Omar,I added new aggregate GetAvailableStock from Stock Database ,set the filter as u suggested and modified the action....now it worked, Thanks ^--^
Hi Denise, as mentioned in my previous response, one of the best way to learn and to identify the cause of such logical issues is to debug the implemented flow. If you're facing difficulties with how to use the debugger, it's worthwhile to invest time in going through these learning materials: https://learn.outsystems.com/training/journeys/debugging-639
If you still need assistance after attempting the debugging approach, sharing an isolated sample OML containing only the screen and logic for which you need help with the community can be beneficial.
Kind regards,
Benjith Sam
Greetings Benjith,Thankyou for the suggestion about the debugging tutorial, it helps me a lot to trace the logic flow error ^--^
A couple of observation worth implementing in your coding
Greetings Siya,I've done what you suggested to me which is making all validation performed above the Form1.valid and moving out "CreatedBy" assignment to Server Action. I also gonna try to perform the validation on server side. Thanks ^--^