Special loop type for arrays & dictonaries - Why?

Dm114

Well-known member
I mean that if I have an array variable of arrays, when I create the loop and select the variable to iterate, I can only select the main array variable, and not any of the arrays contained in the variable.

For example if I have an array named "array-name", and inside this variable there are 10 other arrays with 10 elements each, I can't iterate the variable array-name[first-array], but only the main array-name.

Same thing with a dictionary of dictionaries.

Every now and then it seems to work, but I can't seem to understand.

Maybe it's a bug? @MacroDroidDev

Thanks for your help
Arrays containing arrays are not considered as main array with "sub-arrays" but as array with keys and sub-keys, noted:
- Array[i⁰][j⁰]...[n⁰]
- Array[i¹][j¹]...[n¹]
:
- Array[iⁿ][jⁿ]...[nⁿ]
 

sneike

New member
Arrays containing arrays are not considered as main array with "sub-arrays" but as array with keys and sub-keys, noted:
- Array[i⁰][j⁰]...[n⁰]
- Array[i¹][j¹]...[n¹]
:
- Array[iⁿ][jⁿ]...[nⁿ]
I get that, so, how do I iterate a loop for Array[j]?
 

sneike

New member
I get that, so, how do I iterate a loop for Array[j]?
Still trying to understand. I tried all possible variables combinations, and it seems like you can iterate Array[n], only if Array[n] is a dictionary variable in an array variable. It doesn't work if Array[n] is an array in an array. Maybe it's a bug, what do you think?

@MacroDroidDev

Thanks
 

Dm114

Well-known member
Still trying to understand. I tried all possible variables combinations, and it seems like you can iterate Array[n], only if Array[n] is a dictionary variable in an array variable. It doesn't work if Array[n] is an array in an array. Maybe it's a bug, what do you think?

@MacroDroidDev

Thanks
You're right: I misread and misunderstood your 1st post.

Let's say that arrays and dictionaries are still under development and some of the features are not completely finalized (such as it is not possible to dynamically create "subarrays" inside an main array as it is converted to a dictionary item). As @MacroDroidDev was on holidays (till yesterday) I was waiting to ask him nearly the same question as yours.

So, as he is probably overbooked with his ToDo list, let's give him some more time to finalize this vast (and powerful) array/dictionary feature.
 

sneike

New member
You're right: I misread and misunderstood your 1st post.

Let's say that arrays and dictionaries are still under development and some of the features are not completely finalized (such as it is not possible to dynamically create "subarrays" inside an main array as it is converted to a dictionary item). As @MacroDroidDev was on holidays (till yesterday) I was waiting to ask him nearly the same question as yours.

So, as he is probably overbooked with his ToDo list, let's give him some more time to finalize this vast (and powerful) array/dictionary feature.
Got it. Of course it takes time to develop such a complete and complex feature set. I also noticed my arrays being recognized as dictionaries.

Hopefully @MacroDroidDev will make it flawless.

One more thing I would love is to use magic text in more places, such as when defining variables in if statements, while loops or constraints.

For example in the screenshot attached I would like to check directly the value of {v=devicesOPTIONS[{v=scelta}][{lv=count-iteration}]} against "Cancello", without having to use a temporary variable just for the if statement.
 

Attachments

  • Screenshot_20220817-091124_MacroDroid.jpg
    Screenshot_20220817-091124_MacroDroid.jpg
    138.7 KB · Views: 13

Dm114

Well-known member
Got it. Of course it takes time to develop such a complete and complex feature set. I also noticed my arrays being recognized as dictionaries.

Hopefully @MacroDroidDev will make it flawless.

One more thing I would love is to use magic text in more places, such as when defining variables in if statements, while loops or constraints.

For example in the screenshot attached I would like to check directly the value of {v=devicesOPTIONS[{v=scelta}][{lv=count-iteration}]} against "Cancello", without having to use a temporary variable just for the if statement.
If you have to compare a Magic text with a variable, you can put the variable on the left side of the comparison. But if you have to compare it with a constant, you must use an intermediate variable containing Magic text. So it would be interesting to have the opportunity to put the Magic text on the left side. If it is easy to do, I think that @MacroDroidDev will do it...
 

sneike

New member
If you have to compare a Magic text with a variable, you can put the variable on the left side of the comparison. But if you have to compare it with a constant, you must use an intermediate variable containing Magic text. So it would be interesting to have the opportunity to put the Magic text on the left side. If it is easy to do, I think that @MacroDroidDev will do it...
That was a good tip, thanks. In that macro I do compare magic text with a constant, but I have the constant value saved in a Dictionary variable, so I just put that on the left side of the comparison with magic text on the right side. It works.

Any way, it would be very useful to be able to use magic text in more places. That might be used in if statements, constraint comparisons, set variables, while loop definitions etc. Hopefully @MacroDroidDev will consider it.
 

sneike

New member
If you have to compare a Magic text with a variable, you can put the variable on the left side of the comparison. But if you have to compare it with a constant, you must use an intermediate variable containing Magic text. So it would be interesting to have the opportunity to put the Magic text on the left side. If it is easy to do, I think that @MacroDroidDev will do it...
I just got an update for Macrodroid, and seems like now we can add magic text to the left side of comparisons? That's great, I'll have to check better, good to know.
 

Dm114

Well-known member
I just got an update for Macrodroid, and seems like now we can add magic text to the left side of comparisons? That's great, I'll have to check better, good to know.
What version did you get? On the v5.26.8 it doesn't work yet.
 

sneike

New member
What version did you get? On the v5.26.8 it doesn't work yet.
I have 5.26.8, changelog says "MacroDroid Variable constraint now supports the define keys manually option."
When selecting a dictionary variable in a set variable action or if statement or costraint etc, you can now define manually the key and use magic text there. It's only limited to the key of dictionaries, but I don't remember it was there before.

It doesn't seem to work though and the constraint always fails.
 

MacroDroidDev

Administrator
Staff member
There are still some issues that I have identified in v5.26.8 with complex use of keys in arrays/dictionaries.

Please retry when v5.27 becomes available and if you still see issues use report a bug in the troubleshooting section with a macro that demonstrates the issue.
 

sneike

New member
There are still some issues that I have identified in v5.26.8 with complex use of keys in arrays/dictionaries.

Please retry when v5.27 becomes available and if you still see issues use report a bug in the troubleshooting section with a macro that demonstrates the issue.
Ok, thank you for your work
 
Top