Having trouble in button actions. If anyone can help

Hello Guys, @Darren_Murphy @ThinhDinh

I am having trouble using Button bar for adding items and removing items from the list. This is Form Screen. When I click on Add More, it shows the next item but when I click on “Remove”, it does not set the column value in actions.

CPT2305061430-500x174

Following is my configuration for Add More.

This is my configuration for Remove.

Am I doing anything wrong here? I am not able to figure out.

Are you sure the remove action is falling on your first branch? You can dbl check by placing a show notification above the set column values action something like “yes” or “first branch”

1 Like

You’re checking if size equals 1. In your animation I see 2. I’m guessing it’s not falling into the condition. You are limiting the remove function to only work if there is 1 item.

@Jeff_Hager Thank you for replying. Actually I kept first item at 0 value. So if the value is 1, second item shall be added. In remove action, I am setting column value at 0, so that it should be removed.

Hi @Eric_Penn Thank you for responding.
Yes, its in first branch only. I will try your suggestions though.

image

When I click on Remove button, it always trigger “else” condition.

@Eric_Penn @Jeff_Hager you can see another version of video
ezgif.com-optimize

@Eric_Penn @Jeff_Hager Is this happening because I am doing it inside of Form screen? I tried many trial and errors but not able to figure this out.

Can you show a screen shot from the builder layout so we can see which components you have on this screen and how they are arranged? Make sure you show the whole builder window with both side panels visible.

2 Likes

Hi @Darren_Murphy, thank you for responding.
Here is the full screen.

For checking, you can see, I added “Number” column so that I can see if Set column value is working properly or not. It works properly only once. When It try to add two conditions in “Add More” button, e.g. when Number is 0 or empty, set column Number to 1 and when Number is 1, set column Number to 2. But when I click “Add More” button twice, it only works once.

Can you try something and change the condition for the Add button to not check for empty. Only check for 0. If my suspicion is correct, the Add function should break completely. I think your action IF logic is looking at a value that doesn’t change, so only your add condition is only hit once and none of the conditions are ever met again.

I suspect that it is because you are inside a form. The action is most likely checking an underlying value in the table and not what you have in the entry component. That entry component doesn’t write anything to the table until you submit the form. In some cases, you can access screen values, but I’m not sure if that’s possible within an action.

I usually don’t attempt to do anything beyond the scope of what a native form is supposed to do, such as place a form within a form, or perform any actions while inside the form. I guess you could try writing to, and accessing the number column from, a user profile row. But I think I would just use a choice component instead to set the number in the new row that will be added, and the conditionally show what you need based on the screen value of that number.

3 Likes

Thank you for responding @Jeff_Hager.

That is what I also suspect, because I am on form screen, it may not be allowing me to do it.

That’s exactly I did after trying many other variations.
image

1 Like