Hi. I have this problem contained within another thread but I thought it would be less confusing to post a new thread to ask how to find out what is wrong with my blocks/code. I hope this is OK.
I have created a very simple app that is essentially a poll. It takes two random items (OptionA and OptionB) from an airtable source called “ThisOrThat”. The idea is when a user chooses an option by clicking the OptionA or OptionB button, it will show them how may people chose each option (as a percentage) based on previous choices made by other users.
The code uses another airtable source called “Combinations1” to find out if the specific OptionA vs OptionB combination has already come up. If the combination does not exist, it creates an entry in Combinations1 and adds 1 to the chosen option in the VotesForA or VotesForB field and then updates the percentages in the airtable as accordingly. The app labels should then display the text in the PercentA and Percent B fields.
If the combination of OptionA and OptionB does already exist, it is just supposed to update the VotesForA or VOtesForB field by adding 1 to the chosen option. Then again, the labels should update to show the percentages.
The issue is I am getting strange behaviours using the blocks I have created. It seems like things work sometimes but they do not other times and I can’t work out why. I will follow up this message with the blocks I am using and also a description of the behaviours I’m seeing.
Below is an account of the behaviours I’m seeing (apologies this is so long):
When screen 1 opens:
Everything looks OK
I get a random item for Option A and a random item for Option B appearing as text in the OptionA and OptionB buttons
When I click OptionA button:
The table in Combinations1 updates correctly - a record is created with the correct OptionA and Option B and 1 is added to the VotesForA field, and the PercentA and PercentB fields update
The labels do not update - the label text should be appearing now as the text in the PercentA (100) and PercentB (0) fields, but nothing is displayed
Click Option A again (same 2 options on screen as before)
The table updates correctly i.e. VotesForA updates to “2”
The labels update correctly too - LabelA text shows as 100 and LabelB text shows as 0
If I click Option A button again (still same 2 options as before)
Nothing happens - table record does not update
Click Option B (same 2 options as before still on screen)
Table updates correctly - 1 added to VotesForB, PercentA and PercentB fields also update
Label text does not change (it should change to the new PercentA and PercentB values)
If I click Option B again (same 2 options as before)
Nothings happens - table fields do not update
If I now click “Another”
Gets 2 new random items for Option A and Option B as it should, and shows these as the text in the OptionA and OptionB buttons
The label text stays on screen from the time before I pressed “Another”. I would want this to reset when “Another” is clicked
Click Option A button
Table updates correctly - two new items are added in a new row and the VotesForA field updates to “1”
The label texts disappear where I want them to now show the PercentA and PercentB values for the new row
Click Option B button (same 2 options)
Table updates correctly, so now shows VotesForA=1, VotesForB=1, PercentA=50, PercentB=50
Label texts also update correctly - shows LabelA text as 50 and LabelB text as 50
Click Option A again (same items)
Table updates OK - VotesForA=2, VotesForB=1, PercentA=67, PercentB=33
Labels on screen do not update though
Click “Another” and get 2 options that are already an existing combination in the Combinations1 source
Click Option A
Nothing happens - no records update
Click Option B
Table updates OK - correct existing records update
Try clicking Option A again
Creates a new entry in table with a different (incorrect) Option A but the correct Option B - it should not create a new record line at all as the combination already exists
Click Option B
Table updates correct Option B but wrong Option A existing combination
Click Option B again
Updates table with new record containing both wrong Option A and wrong Option B
If anyone can help in any way it would greatly appreciated. Thanks!
I don’t want to speak for others here but for me, this is way too much information to be able to help you in an efficient manner. It would take me a long time just to understand everything you’ve posted, much less figure out what might be wrong and then work on solutions.
If your project is this complex, you might consider either paying someone to help you as a consultant or contacting Thunkable Support (assuming you have at least a Pro plan).
There’s no need to remove the topic! It’s never a bad thing to ask a complicated question. I just know that the time I would need to invest in something this long is only worth it if I’m getting paid… just being honest.
Someone else might have the time and interest. But if you don’t get any help here, consider simplifying things, if possible, to ask a single specific question.