Hi,
I am trying to run a simple javascript for loop in bubble. When I click a button a javascript to bubble gets fired which has a for loop,
let x = 3;
myList = [];
for(i=0; i<x; i++){
myList.push(i)
}
bubble_fn_function(myList);
I am trying to get the for loop to write the values 0,1,2 (as an array or otherwise) in the database and output to screen using a repeating group. I am not getting anywhere with it. Is this possible or am I doing something wrong? Or is there a better way to do this? Basically I just want to pass the output of a for loop which has multiple values to bubble and display using a repeating group. Any help would be appreciated.
Thanks,
George.
1 Like
Hi rpetribu,
Thanks for your time. I basically want to run a for loop using “javascript to bubble”, say,
for(i=0; i<10; i++){
bubble_fn_foo(i);
}
and be able to pass and display 0, 1, …9 using a repeating group (or a better way), Sorry, I am still new to bubble and trying to figure out how to use javascript in bubble.
Thanks,
George.
So…
- Generate you Javascript:
let x = 3;
myList = ;
for(i=0; i<x; i++){
myList.push(i)
}
bubble_fn_function(myList);
- Pass the result list to Bubble:
- Now you have a list. You can check it out thru a simple text field like this:
It will display “0, 1, 2”
- Use it as a RG:
This is the result:
1 Like
Many Thanks, works fine…All good now.
1 Like