I would suggest either to create a macro to remove apps (physically and in your array) or re-populate a new array with remaining apps.Let's say I have an array which has stored the names of the apps I have. Is it possible that if I remove one of those app, its entry is removed from the array ?
So is not possible to manually uninstall an app and the macro (using as trigger "application removed" to get the app name) removing it from the array ?I would suggest either to create a macro to remove apps (physically and in your array) or re-populate a new array with remaining apps.
dictionary[app name]=app package
and one dictionary[app package]=app name
.Pretending I have other apps in the dictionary, what's the formula I have to write in the "clear" action?If you want to do it with an array, you'll have to iterate the whole array to find the key then delete it. If you want the array to not haven't a missing index then you should json output then json parse but it may only work fine with sub-arrays.
However it is easier with a dictionary.
I have 2 dictionaries of installed apps,dictionary[app name]=app package
and onedictionary[app package]=app name
.
This lets me choose the entry I want easily, for example to find the app name based on the app package and the other way around or delete the entry (dictionaries also don't have the problem of missing index).
WritePretending I have other apps in the dictionary, what's the formula I have to write in the "clear" action?
[[app_name]]
.After that I tried both "clear value" and "delete key" but nothing changedWrite[[app_name]]
.
[[app_package]]
), so you have to do it this way.dictionary[app package]=app name
Unfortunately MD Dictionaries are not (not yet?) real databases so we must have 2 of them to have a 2-entry system. As we generally don't deal with huge amounts of data, it's fully "philosophically" acceptable and... efficient.If you want to do it with an array, you'll have to iterate the whole array to find the key then delete it. If you want the array to not haven't a missing index then you should json output then json parse but it may only work fine with sub-arrays.
However it is easier with a dictionary.
I have 2 dictionaries of installed apps,dictionary[app name]=app package
and onedictionary[app package]=app name
.
This lets me choose the entry I want easily, for example to find the app name based on the app package and the other way around or delete the entry (dictionaries also don't have the problem of missing index).
What's the problem of missing index ? It's because you don't like when it's missing?If you want to do it with an array, you'll have to iterate the whole array to find the key then delete it. If you want the array to not haven't a missing index then you should json output then json parse but it may only work fine with sub-arrays.
However it is easier with a dictionary.
I have 2 dictionaries of installed apps,dictionary[app name]=app package
and onedictionary[app package]=app name
.
This lets me choose the entry I want easily, for example to find the app name based on the app package and the other way around or delete the entry (dictionaries also don't have the problem of missing index).
There is the "clear array" action but I don't know how to make it remove the entry of the apps I uninstall.
If you want to do it with an array, you'll have to iterate the whole array to find the key then delete it. If you want the array to not haven't a missing index then you should json output then json parse but it may only work fine with sub-arrays.
However it is easier with a dictionary.
I have 2 dictionaries of installed apps,dictionary[app name]=app package
and onedictionary[app package]=app name
.
This lets me choose the entry I want easily, for example to find the app name based on the app package and the other way around or delete the entry (dictionaries also don't have the problem of missing index).
Unfortunately MD Dictionaries are not (not yet?) real databases so we must have 2 of them to have a 2-entry system. As we generally don't deal with huge amounts of data, it's fully "philosophically" acceptable and... efficient.
What's the problem of missing index ? It's because you don't like when it's missing?
Ok thanks, I'll use dictionary thenDictionary of MacroDroid is much like JSON which is similar to but not an object. (i.e., key-value dataset structure without characteristics of object)
So it isn't database as you said and in my opinion is isn't likely to be evolve to database, because both concept are too different.
It might not be harmful directly but may causes unexpected result when processing.
If you want to keep using array, my Action Block above will prevent the problem.