https://discord.gg/botpress logo
This could be acomplished with an Execute Code car...
# 🌎general
b
This could be acomplished with an Execute Code card. I suspect that you would get pretty good results using the AI code generation feature with a prompt like "Generate a random number from 1 to 78. Store it in a worflow variable called 'randomNumber'". This will generate the random number for you. Add that variable you your flow in the variables section. You can then use this variable in the "Get Record" card. For the Record ID field, just hit the
{x}
button and put in
workflow.randomNumber
. Select your table and store the result in an appropriate variable. Update: I tested that prompt for AI generation on the Execute Code card and the generated code is correct for achieving this. However, a more robust approach might be to use a prompt like "Generate a random number within the range of valid Ids for the table 'TableName'. Store it in a worflow variable called 'randomNumber'." Where 'TableName' is the name of your table. This is a more robust solution because it will dynamically get the number of records in your table, and you will not need to update your code when the number of records in your table changes.
2 Views