Hi Folks
Battling with a 2D array creation. I want to store some user detail against a device mac as the Key (In my example below 1, 2 & 3). If I manually create the structure I can change each field individually. If I create them dynamically in a loop with the “same” commands, changing one field updates all 3 fields on that level.
Some script info:
Use code tags when posting code in the forum. Better to read and tabs in front will be seen.</>
You do not need semicolon after all lines, only between commands on same line ;
From the Wiki, MT stats that $ should be used when set a variable. I do see it works without, so not 100% sure whats the best way: https://wiki.mikrotik.com/wiki/Manual:Scripting#Operations_with_Arrays
Thanks Jotne
Making those changes causes the key to become lost. I’d ideally like to retain the key functionality.
My ultimate goal is a dynamic array like this :
maclist={A1:B1:C1:D1:E1:F1={ firstseen=April202020; lastseen=April252020; throttled=false }; A2:B2:C2:D2:E2:F2={firstseen=April252020; lastseen=April262020; throttled=true }} etc
Creating the array one mac at a time works from the DHCP script, as well updating it.
Now I’d like to create the global array from a script using an address list as the source. The dates will be updated from the DHCP script and the throttle status from a scheduled script.
The array commands and the looping dont like each other. Thank you for the constructive comments on scripting. Rgds Puffer