MainStructure is a structure with one or many levels (ex : myStructure.SubKey.SubSubKey…)
KeyPath is the path for the key to be deleted (ex : SubKey.SubSubKey…)
I wrote some code to make it happen, but it’s still at the prototype stage
The first solution, deleteKeyWithReference, use the pointer of the structure to delete the key I want
The second solution, deleteKeyWithEvaluate, use the Evaluate function, but I am very uncomfortable using Evaluate for security reasons (or excessive paranoia)
It’s working, but I wonder if there is a better way to do it? I tried several things to concatenate the variable (the structure) passed to structDelete, but no luck. I have the impression that the code could be simpler, but that a detail escapes me. Maybe it’s just a syntax problem.
The first argument of structDelete must be dynamic. I pass to my function the first argument myMainStructure, then the second argument is the path of the key (as a string) I want to delete (ex. : “B.SubKey.SubSubKey” or “B.SubKey” or “B”).
It’s a component I created to manage session variables (in a specific way for my app) and to make it easier to read/write/delete session variables and all the logic to test if the variable exists before and/or return a default value if the variable doesn’t exists. So when I call this component, I always pass myMainStructure (it’s always exists in my app), but the path to the SubSubKey may not exists in some situation.
Maybe I need to step back and review all my component if I can do it differently.
Which seems reasonable given some of the functions like findKey return a path as part of their response. Sounds like a reasonable enhancement request to me, raise a ticket on JIRA for it. Doesn’t help you right now, but you have your functions that works for the time being.