I want to create a simple quantity calculator which inputs how much quantity each customer has purchased every day.
I have managed to create a Customer data resource and an input field where user Inputs his Customers names and it gets shown to him via Basic List component.
Now I want to create a page where First user needs to pick a date, then All his customers are shwon to him with an input field in front for them to enter total quantity he sold to that customers on that date. After user has done that for all customers, and at the bottom of page is a Save button which saves all data in data resource is updated automatically.
Can Anyone help me how to create any such type of app ? Or any video tutorial for it ? Thanks allot in advance!
Yes I have watched the videos and made some progress.
But I’m having 2 main issues.
I’m using a section’s repeat function to repeat the section. But inside that section which is set to repeat property, If I put any input field, it automatically refreshes to default value after a second. making it unable for user to input anything.
I have a list of objects and I want to add a list each time user selects a different date, I know it can be done using with_item, but where am i suppose to do that? I tried using js flow funct and in it’s input field use with_item formula but nothing works.
Sounds like you have a refresh loop going on for the data either on the data logic canvas or in the composite component, if you’re using one of the ready built ones. Disable the loop if you also want to edit the data.
You need a variable into which to add, e.g. page or data or app variable. Then from the onTap event from the component where the user selects the date, you use set page/data/app variable and in that flow, use WITH_ITEM.
Yes, I looked into data’s logic and I found that it was refreshing after 5000ms which was causing this issue. I changed fetch data delay time to 5000s from 5000ms. I hope it won’t make issue in any rest app. The issue for now, is fixed.
Second, I’m afraid I wasn’t able to explain properly…
I created a on-device data resource which includes id, customer name, and a list of object (object includes date and quantity types).
Now I want user to enter data for specific customer, and that data creates a new object in that list of object.
For this, I found WITH_ITEM will work, I created an object page variable with same two items. I ask user and store value in Object-page variable.(https://i.imgur.com/vl8kwj6.png) Then I will add that page variable to my main data resource list of object variable .
The formula would look like this https://i.imgur.com/KSEe0ZP.png
Now my only issue is , how to implement this formula in logic section to get the desired result ?
If to use js, how should I use this js?
I tried like this :
So you’re currently trying to add to repeated.current, which will not populate your backend. Adding to page/app/data variable would work (using set app/page/data variable flow function), but if you also want to edit the data resource on the device, you need to do it like this from the button tap / other event where you want to fire the event:
Use update record for your on device resource. Get the id for the item from repeated.current.id if the button/event fires from within the repeat, or use LOOKUP formula. If you edited repeated.current directly, you can just pass that to the flow function
After update record has succeeded, you might want to refresh the data on the page, in which case you need to get record collection again and set it to your data variable.