Is there any way to obtain the name of a component as a text

Hello,

I would like to store the last value of a component like Switch (for example) in a database.

For that, I have to use TinyDB.Store Value method.
To simplify, I would like to use component name as tag in which I will save the value.
It will allow to use Any Switch Method for all my Switch.

The problem is that Component Name or ID is not text…

Is there any way to obtain the name of a component as a text ?

Thanks in advance for your answer.

Go to component blocks and drag last block of the component…
Connect that block to a label.text
You will get component (ID)

1 Like

Thanks,

That’s what I tried but I cannot stick this last block of component to a label.text like the type of data was not OK.
I found a way to do it. It’s to store the component(ID) in a variable and then affect the variable to the text and this time no problem I can stock the block.

It’s quite more complicated and It seems strange that we cannot stick directly the ID to text.

I cannot Stick directly like this
2020-04-20 23_10_26-Window

But I can if I use intermediate variable to do it
2020-04-20 23_10_41-Window

If you know how to make it directly without variable. I’m interested.

Hello, did you managed to do it in an easier way (get the name of a component) ?
I’m actually interested into it too :slight_smile:

You can not save component names as Tags/Keys