You need to collect the values one-at-a-time, correct? So use a loop, changing the loop item each time from a list.
How many switches are there? What is the label for?
I can help you with the Loop and List(s), but later tonight as I'm actually working on a building site right now
A very quick example showing how to setup the Lists and Loop:
You can add your Labels with a List of their own and populate them using the same Loop.
Click on the image to view/download.
CloudDb_SimpleExample.aia (3.2 KB)
1 Like
hi, sorry for late answer but I was out of home.
thanks for tip linked with download screen from block - next new thing which I know about this program hehe
answering for your questions:
I have 10 switches which switch on / off the led
I have 10 sliders which define the time of shining the led
I have 10 labels which gives exact information which time is set on slider
below you can see the whole code from inventor - right now it is configured in option that it is saving and taking remember values from tinyDB.
bease on your remarks I will try to rebuild this using cloud DB
centralny.aia (67.9 KB)
I try to modify my code using your example but I think that I am making something wrong because all the time when I open app switches do not remeber last position before app closing, please can you verify. thank you
My code only shows you how to handle the collection of the values from CloudDb. You can use a similar loop to update the values @ CloudDb.
You probably want to start with just my code and build from there.
hehe, yes you are righ ... I tried build the code exactly on your example
I will play with this, I hope I will reach the target, I will inform you about the results
but example which you show should work independently, yes? and should remember position of switch in your app? because I am switching on changing position and switching off and position is always off after next switch on
The graphical representation is remembered - up to you when the switch states are stored in CloudDb. In this quick example, they are stored on Button tap. You could run the same Procedure on App Exit.
Updated Project (No effort on the GUI side!)
CloudDb_SimpleExample.aia (4.1 KB)
I will make deeper analyze of your code in the morning, because I think that I make something wrong running your example because all the time after changing switch position and off the app and restart again all of them are on off position, there is something strange because even when I not pushing update button switch 10 jumping on / off and finally staying on off like all other buttons
I see what you mean Leszek - the loop is too fast! So instead, we can use Clock Timers, imposing an interval between each contact with CloudDb. In the updated sample file below, I have set the time interval to 1 second. That works fine here, maybe a little slow. See how it goes with your device. It is simple to tweak the intervals.
CloudDb_SimpleExample.aia (8.1 KB)
hello, many thanks for your support and help - right now it is working fine and updating switch positions, I have in my opinion last question: from where you take this block (set Switch.ON) because I can not find it anywhere and second question how should I proceed when I want to replace it to update slider position and values of slider in label?:
It's in the "Any Component" section - and you will find a similar one for your Sliders and Labels, both of which will need to have their own Lists in the same way as the Switches.
Another way to do it would be to save the state of all the switches in a single tag.
1 Like
super, thank you very much for information, I will try to adapt it to my app - I will share info about the results
I think Juan's method will lend itself well to the slider positions too - and upload/download a bit faster maybe.