Forum Discussion
shopkeeper56_23
Cirrostratus
Sep 20, 2016Recursive Data Group Match
Hi,
I'm trying to perform a recursive binding of variables based off information in a large source string of values and a Data Group.
Here is the pseudo-logic of what I'm trying to perform....
Kai_Wilke
MVP
Sep 20, 2016Hi Shopkeeper56,
you may try the iRule snippet below...
Datagroup:
ltm data-group internal DG_RESOLVE_CHARS {
records {
A {
data 1
}
B {
data 2
}
C {
data 3
}
}
type string
}
`
iRule Snippet:
set input "A | C | Z | F | G | H | T | B"
set output ""
foreach char [split $input "|"] {
if { [set dg_value [class match -value [string trim $char] equals DG_RESOLVE_CHARS]] ne "" } then {
lappend output $dg_value
}
}
log local0.debug "Output: \"$output\""
Logfile:
Sep 20 17:15:27 f5-02 debug tmm[11263]: Rule /Common/Debug : Output: "1 3 2"
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
