Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfscript>
- testdoug = structNew();
- testdoug.dataarray = arrayNew(1);
- testdoug.dataarray[1] = structNew();
- testdoug.dataarray[1].finaldata = 'mary';
- testdoug.dataarray[1].guid = '100019';
- testdoug.dataarray[1].morearray = arrayNew(1);
- testdoug.dataarray[1].morearray[1] = structNew();
- testdoug.dataarray[1].morearray[1].finaldata = 'george';
- testdoug.dataarray[1].morearray[1].guid = '100021';
- testdoug.dataarray[2] = structNew();
- testdoug.dataarray[2].finaldata = 'ralpha';
- testdoug.dataarray[2].guid = '100035';
- testdoug.dataarray[2].morearray = arrayNew(1);
- testdoug.dataarray[2].morearray[1] = structNew();
- testdoug.dataarray[2].morearray[1].finaldata = 'lucy';
- testdoug.dataarray[2].morearray[1].guid = '100043';
- testdoug.dataarray[2].morearray[1].morearray = arrayNew(1);
- testdoug.dataarray[2].morearray[1].morearray[1] = structNew();
- testdoug.dataarray[2].morearray[1].morearray[1].finaldata = 'ethel';
- testdoug.dataarray[2].morearray[1].morearray[1].guid = '100092';
- testdoug.dataarray[2].morearray[1].morearray[2] = structNew();
- testdoug.dataarray[2].morearray[1].morearray[2].finaldata = 'lisa';
- testdoug.dataarray[2].morearray[1].morearray[2].guid = '100089';
- writeDump(testdoug);
- writeOutput("<hr>");
- </cfscript>
- This pattern could continue many levels deep.
- Goal: Use structFindValue to locate a particular GUID. Then change the value of final data associated with that particular GUID.
- Attemps to dynamically build the path in a variable then evaluate that variable to be able to modify its value have failed.
- Challenge: Given the structure above. Search for GUID 100092 and change the value of finaldata from ethel to ricky.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement