I'm adding multiple concatenations of comboboxes/dropdowns to a textbox and inserting it into an SQL database, depending on the number of options the user selects in a combobox. For example, if they select three markets, then three rows will be added into the table, four markets, then four rows, etc. The concatenation is exactly the same on each row, except for the country code.
When a button is press, it looks to see if it exists in the table already:
If it doesn't, will Patch() the new values in. If it does exists, an error notification pops up saying the value already exists. Because the SQL database has a lot of records that will constently have values being added to it, I have done a ClearCollect() function that creates a collection as I was getting a delegation warning.
When I initially press the button, I have no issues. I also have a Remove button that will remove all the selected values in the gallery (where all the text values are stored):
Again, that button works fine, even with a fair amount of markets. Where the issue lies is adding these text values back in.
Say I add in 14 markets the first time, 14 rows get added to the SQL table so prefect. If the user removes all these values and then tries to re-add them, they will only add 12. Even though there are no repeat values and it was working fine the first time round. If I repeat this process, it will only add the rows minus one or two each time.
Am I missing something? Has anyone experienced this sort of issue before?