Hi, Did a search for this, can't find an answer, so apologies if it's covered. FR 3.1.0 latest from git. Is there any way of getting the index # of the variable I'm looking at in a foreach loop? After doing a sql map (new functionality) I have back a number of rows from a sql DB, and want to reference the index of each variable I'm updating, but I need to know where I'm at in order to do a variable[x] for the other variables that match the one I'm doing a foreach on, if that makes sense. If there isn't an easy way, I'll pass the index back from SQL as a field, but it seemed kind of unnecessary if there's a simple way. Thanks! Andy
On 14 Dec 2015, at 09:02, Franks Andy (IT Technical Architecture Manager) <Andy.Franks@sath.nhs.uk> wrote:
Hi, Did a search for this, can't find an answer, so apologies if it's covered.
FR 3.1.0 latest from git.
Is there any way of getting the index # of the variable I'm looking at in a foreach loop? After doing a sql map (new functionality) I have back a number of rows from a sql DB, and want to reference the index of each variable I'm updating, but I need to know where I'm at in order to do a variable[x] for the other variables that match the one I'm doing a foreach on, if that makes sense. If there isn't an easy way, I'll pass the index back from SQL as a field, but it seemed kind of unnecessary if there's a simple way.
No, you'd need to use expr to create a simple counter. -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
participants (2)
-
Arran Cudbard-Bell -
Franks Andy (IT Technical Architecture Manager)