Hi, I am currently making an app that scans items in and out.
I have figured out the requesting an item and scanning out an item steps, and now I am working on the scanning items back in part.
On the first screen, it asks if you have an item to check in. This opens the Return Items Popup. In this popup, I have a QR Code Scanner from the QR Code Scanner plugin. Once you hit scan and then the QR code picks up data, it will go to the Scan Another Item Popup. This popup asks if you’d like to scan another item in, and if you hit yes it will send you back to the Return Items Popup. Once you’re done scanning your items, you need to scan a QR code of the place you’re dropping off the items at, in this case a drop box. On this Scan Drop Box Popup, there’s a final QR Code.
Once that QR Code is scanned, all the items will be marked checked in and the location will be the location on the drop box.
Right now, I am having trouble making a list of items to be scanned in. I can scan in one item, but when I go back and try to scan another the data overwrites the first item and replaces it with the second. What I’ve been trying is to add a group with the data type “Items” and then using the Make Changes To function to change that group’s Item’s, and basically pass the information between a group on each of the popup pages, but it’s not working as I keep overwriting.
How do I get it so I can go back and scan in as many items as needed so I can check in multiple items at once? Thanks so much for your help!
I believe what you need is to be able to add another entry to the list of things in a custom state by using Set State. I replicated your behavior and popups. Below, for example, I add the QR code’s value to a list in a custom state and then print the elements in this list to a repeating group successfully.
This looks like not an intuitive behavior. Given the name of the action is set state and you add something to a list custom state. But still, it works.
To complement @hergin great solution there is another alternative to using custom states in case you need to use dynamic conditions to this list of scanned items.
Add a popup that you will never open
Add a repeating group to it and set it to be one row one column and make it small so that your popup does not have to be too big. Size of the rg does not matter as it will be used to hold this list of scanned items as a state value.
Make the data type whatever is needed for the plugin to function. I see that there are two QR scanning plugins called QR Code Scanner in the plugin store. The outputs of one of the plugins are texts … so let’s assume that you need to store a state value of texts … so … please make the rg of type “text”. It will hold then a … list of texts.
As you add more scanned items then use the action display list in a repeating group with the plus item operator.
How-to below (the screenshots show an rg on page because it was easier to take screenshots this way ):
Hi @hergin and @cmarchan, thank you both so much for your responses!
The Set State is an interesting idea, and one that I had not encountered before while making my app. @hergin, is it possible to see the rest of the workflows you made so I can see what’s happening? Are you setting just the state of the Scan Another Item Popup (as opposed to the page itself or other popups)? Does that work when going back and continuously scanning in more items? Where are you printing the elements to a repeating group, or why would you need to? What do you mean by it’s not an intuitive behavior?
@cmarchan, what would be an example of a dynamic condition? Is my needing to hold all the data until the end of the process a dynamic condition?
My final question is for the type of content. Yes the QR Scanner is picking up text, but I eventually want it to be able to convert the text into an Item data type by doing a search for the only Item in my database that has that QR code content. In that case, should my var/Set State’s Type of Content be “Items” or do we still want text and we’ll do a search for the proper Items at a different step?
The behavior I meant as not intuitive is SetState action’s also updating the state. The name and the structure could have been more clear. But, hey, it works, right
Yes, it works continuously scanning because it is not overwriting the ID now, but it is adding one more qr content to the list.
I am not printing anywhere myself. Check the repeating group’s data source. It is the state that I am appending the new qr content. I don’t need to do that. I just wanted to show you a place you can collect and show things. Technically, the QR information you need is in the state here: Popup Scan Another Item’s Scanned Items list. You can do anything with that.
For this part of your question, I kept them as text in the example. But you don’t need to do that. You can set the state a List of whatever you want. As long as there is a place where you can put the QR content in it (or do something with the QR content, such as finding an item with that QR content), it should be fine. Actually, if you will get a list of Items at the end, I would probably store the state as a list of Items rather than list of Text. Then, you can get this list and do whatever you want.
Hi @hergin, do you know how to convert the QR content (text) to do a search for the Item data type? Where do I do the “Do a search for” action? Is that in the Data source area in the Scan Another Box Popup where we added the Set State? Or in the workflows section? Right now the Set State workflow action is evaluating to a text, which makes sense, I still need to convert it, I just don’t know where to do that. Maybe there’s two states where one is the text and the other is the converted Items? Thanks so much!
Also, I made a change to your workflows, I made it so “When QRCodeScanner A has data” then the change to the Set State happens and the Hide/Show actions happen. So currently this Set State is happening right when the QR Code Scanner gets the Item data.
Instead of this, you can do a search for by using the QR content and find something else based on that search and add this to the custom state (assuming you change the type of the custom state from text to whatever you store). Something like below:
Hi @hergin, I was able to successfully add this Set State, the only thing I changed from your Set State example was adding “first item” to the search for Items because it was giving me an error.
I am finally on the last step, which is scanning in the Item using the final QR code scanner in my Scan Drop Box Popup.
I think I will need to go into my database and add a location data type where the Drop Box QR code is connected to a location in my database, but what I am really having trouble with is calling the Set State items and then using them to change the Items data.
In my database, Items have fields for:
Location (Location Type)
Checked Out? (yes/no)
Checked out to (User type)
QR-Data (text)
I assume that once QR Code Scanner B (our Drop Box scanner) has the data, we will make the changes to these boxes by doing a “Make changes to” action in our workflow.
So, how do I tell the workflow “Ok, the User has these Items to check back in in our Set State. You now know the Location because we just scanned it. Make the changes to the Items in our Set State, change the Location to the Drop Box QR’s location, and change those other fields as needed (Checked out to No, Checked out to No one).”? I can figure out the Checked out to = No and the Checked out to = No one, it’s just the first two changes I am struggling on.