Right hi everyone! I’ve been lurking on this forum for the past few days trying to figure out how to have 2 buttons inside an RG that adds/removes items into another RG . I’ve watched as many youtube videos as I can find on this but I literally cannot figure out how to do it.
Please can someone help.
The specifics:
I have 2 repeating groups:
Screen Inventory
Cart
Inside Screen Inventory RG I currently have 2 buttons - “add screen” and “remove screen”
I can add screens to the cart by pressing add screen however removing them seems to be extremely difficult.
I have a separate remove screens button inside of Cart which works however but that same logic isn’t working for the Screen Inventory RG Remove screen button…
if you have a few min to spare, I would sincerely appreciate any help you can offer
How are carts and screens are linked in Database?
1 Like
Thanks for the reply
Carts are a data type with the following fields:
And Screens are a data type with the following fields:
Is that linked or do I need to do something to link them?
Cheers
So cart holds a list of screens and cart is in Users datatype?
Add “Screen” with type “Screen inventory” to “Cart”, While adding screen to the cart, also add “Screen=Current cells screen”.
While removing, something like “Current cells carts screen” should work
1 Like
Exactly yep - cart holds a list of screens and cart is in Users
I’ve added “Screen” with type “Screen inventory” to “Cart”
The add screen works however the remove is still showing as not functioning
I seem to not have an option for “Current Cells’s Cart’s Screen”. Do i need to change something in the db?
Wait, it looks like each cart holds a single screen in the database and user should be having a list of carts associated with him/her. Is it?
Generally, cart system works like this :
There will be 2 datatypes, Cart and Cart items.
Cart items holds each cart item, their respective quantities and details.
Cart is a list of “Cart items”
And User contains this cart.
When you are trying to remove something, you just delete it from “Cart items”.
1 Like
So should I create another data type called cart items and put in all the data shown in cart?
Exactly. Create another datatype “Cart items”, also add “Cart” type to “Cart items”.
Whenever user adds a screen to their cart while their cart is empty, do this
- Create a new cart
- Make changes to user and add this cart to user
- Create a new cart item and cart=Step 1s cart
- Make changes to current users cart and add step 3s cart item
Now, cart is actually a RG of cart items with cart=current users cart
Whenever user clicks on remove, Delete a thing
Current cells cart item.
1 Like
Ah amazing - I’ll try this now.
Really appreciate your help
1 Like
If current users cart is not empty,
- Create a new cart item
- Make changes to current users cart, add step 1s cart item
1 Like
I seem to be unable to find the “Current Cell’s Cart Item”
Here’s what I’ve changed:
I’ve created a new data type called Cart which contains list of cart items:
I’ve added cart as a field in cart items data type:
I’ve adjusted the flow of Add screen although now it appears to add 2 entries for each screen
And I’ve tried to change the remove screen flow but Current Cells Cart Item doesn’t appear for some reason
Edit - I realise that the delete input currently entered is incorrect however there seems to be no option to enter Current Cells Cart Item
Screen inventory RG is the list of screens in the current user’s cart right?
Then the Data source should be “Search for Cart items with cart=current users cart”
This will give you a list of screens in current users cart. Now it’ll give you an option to delete Current cells cart item
1 Like
Screen inventory RG is “Do a search for Screen Inventorys”
And Cart Items RG is:
Basically Screen Inventorys should show a list of all Screens. From this list, the user can add screens to Current user’s Cart and then should be able to remove screens from Current user’s Cart.
Users though should only be able to add a maximum of 1 of each screen - currently they can add infinite…
Currently I can remove Cart Items from the Cart directly using the Button X in the RG Cart Items but I can’t make this work for the Button - Remove Screen in RG Screen Inventory
Ahh I got you now.
Do this when Remove button in Screen inventory RG is clicked…
Delete a thing
Do a search for cart item with screen = current cells screen
This will remove screen from current users cart
Thanks - the screen option though is only for contains, doesn’t contain etc.
Again i really appreciate all the help!!
I have screen as a field in cart items as a list of screen inventories
That should be a single screen. Not a list. As each cart item will only have one screen
Ah good spot - thank you
I’ve changed that now but still an issue seems to be prevailing
The issues log says that this
Also Add
Cart= current users cart
To the search.
Click on More and select :first item
Thanks - we seem to be getting closer however the constraint seems to be invalid