Same code, different result

Hi, all,

I am here asking for your help again.

As you know, I am trying to learn day by day how to program and, since a few days ago I am having a trouble with a block called “Sensor List” included in the @Taifun Tools extension. I want to use this block to obtain only the name of the sensors installed in my phone (Samsung A31) so, searching in Google I find this article giving a solution based in MIT AI2. Well, I done a little adaptation in the code and I done a test in MIT AI2 working perfectly:

After that, I tried to apply the same code in Kodular and… the chaos is here, I have the next error:

imagen

And the information obtained is totally different:

Doing a validation in JSON formatter, the information obtained in MIT AI2 is correct, but not occurs the same with the information obtained in Kodular:

imagen

Reading this article of @plantdoc2018, I think the error is caused by the parenthesis located at the beginning and in the end, so I tried to remove them, change them for brackets, but no way, it doesn’t work, I only obtain different errors.

My question is easy: using the same code, is Kodular working in a differente way in comparison with MIT AI2 or am I doing something wrong?

Have in mind, please, that I am a beginner so, :notes: don’t be cruel :notes: with me.

As always, thank you so much for your help. Best regards,

Joaquin.-

Try this

1 Like

Excuse me, Adriraj_Saha, but I don’t understand you. Can you give me an example, please?

Fantastic, dora_paz, it works like a charm, I can use it right now, I only have to find the way to separate in different lines each sensor to see the result in a more aesthetic way, thank you very much.

But I still have the same doubt: MIT AI2 and Kodular treat the information differently using the same code? It is a mystery to me.

Thanks a lot for your help. Best regards,

Joaquin.-

Hi, dora_paz,

Based in your solution, I think that I’ve found another way to obtain what I want formatted as I want:

What do you think about it?

Thank you very much one more time. Best regards,

Joaquin.-

2 Likes

You can modify code according to your needs :slight_smile:

1 Like

This is really good work and we expect the same from all members to work like you…

1 Like

Thanks a lot, Gowri SankaR, it’s very kind of you.

Best regards,

Joaquin.-

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.