Card Block Internal Value for Dynamic Data

Reproduction 1. Set some variables that are arrays of strings, such as teamsIds, teamsNames and teamsCities 2. Connect a Card block, with dynamic data: {{teamsNames}} as its Title, {{teamsCities}} as its Description, and an arbitrary string for the button such as Check Team Matches 3. Try to put {{teamsIds}} as the Card's Internal value 4. Preview the bot Desired behavior I want the internal value of a selected card to be dynamic — in this case the ID associated with the team from the teamsIds array. Sample data: const teamsIds = [12, 4] const teamNames = ["Hawks", "Celtics"] const teamsCities = ["Atlanta", "Boston"] When the user clicks on the Card with Celtics as its Title, I want the internal value of the selected card to be its associated ID in teamsIds, which is 4 in this case. That internal value (selected card) should also be saved in a variable selectedTeam. Suspected issue Internal value seems to only work as expected when the data isn't dynamic and that the internal value is a fixed string, regardless of which option we selected. The Save in variable option only allows to save a specific field from the card (like "Title", "Description" etc.) and not its internal value (which defeats the purpose of an internal value aside from solely displaying it to the user?). ↓ In the following example, I set the arrays variables with a Script block that simulates the API call I'll make in production (which you get a peek at below it), with setVariable() lines. I confirm that the variables are created and with the expected data, as the cards are successfully dynamically generated from them.
No description
9 Replies
Anthony
AnthonyOP3w ago
Bot preview TL;DR: clicking on "Check matches" should set a selectedTeam variable to the ID of the selected team.
No description
Baptiste
Baptiste3w ago
Thanks for the detailed report!
Baptiste
Baptiste3w ago
Just pushed a fix 🙂 available in 10 min in production build failed. Pushing tomorrow
Anthony
AnthonyOP2w ago
I see that the GitHub issue is marked as completed, and I see an "Internal value" option has been deployed to be saved as the variable of the selected Card element. However, there are 2 issues: 1. Putting an array variable as the internal value returns it literally, instead of the array element at the selected card index. It means that when I put {{apiTeamsIds}} as the internal value and made it so that the saved variable {{selectedTeam}} is the Internal value, it returned my array like [12, 4] literally instead of either 12 or 4 (index of the selected element). 2. I also noticed that, unrelated to the internal value issue above, when setting the saved variable to Title, the variable's value always returns the same value of an arbitrary title, not the one selected by the user. For example, while many cards are dynamically generated, if I click on "Check matches" for the "Bulls" team (where the Card Title = "Bulls"), the selectedTeam variable returns Providence Steamrollers which is the name of another team (not the first, not the last, just that arbitrary card title among all of them).
Anthony
AnthonyOP2w ago
Showing result & config of point 2 ^
No description
Anthony
AnthonyOP2w ago
Showing config & result of point 1 ^
No description
No description
Baptiste
Baptiste2w ago
Thanks Anthony!! 🙏

Did you find this page helpful?