Newbie here, so I’m sure I’m missing something simple. Here’s what I’m trying to do:
- Choose a random record out of a collection of records (Firebase)
Here’s my approach:
- I numbered the record IDs 1, 2, 3, 4, etc.
- I tried to get the ‘totalCount’ from the collection, and then…
- Use this formula: RANDOM_INTEGER_BETWEEN(1, outputs[“Get record collection”].totalCount)
- Then, I would use that random integer as the ID to call a specific record.
As far as I can tell from the Debugger and tons of testing I’ve tried to do, the record collection is being called successfully (there are 5 records), but I can’t get a page variable of any type to save that totalCount data. What am I missing??
Here is what my flow function looks like:
I had to use the COUNT() function in a formula to get my count. Something like COUNT(outputs[“Get fresh Category data”].records)
@Adam_Wike , thanks for your response. I did actually try that already, but I’ll recheck that. It must be able to work if it worked for you. ::
Well, I feel silly now.
I swear I had tried all of these possibilities before, but it’s working now! Too many hours at the keyboard I guess.
I did end up using: COUNT(outputs[“RecordCollection”].records) which I was then able to set as a numerical page variable called recordCount.
I then used: STRING(RANDOM_INTEGER_BETWEEN(1, pageVars.recordCount)) which I then set as a text page variable, and I then used that variable as the ID for GetRecord.
Yeah, not sure why the output doesn’t work, but a fairly easy work around. Glad you got it going!