Forum Discussion
Cindy_Berry_103
Nimbostratus
Aug 14, 2012How to create a Datagroup with Multiple values
I would like to create an external datagroup that contains multiple values for one key. I have seen the following format posted several different locations....class namevalue { "name1" := "value", "name2" := "value", } class namevalue { "name1" := "value1", "value2" ,"name2" := "value", "value2", }
External Class Format:
However, I would like my external format to look like this, and be able to reference values1 and values 2 based on the key.
External Class Format:
For instance, in the scenario that I am using this in the file format might look similar to the following:
"/ug/atl" := “http”,"/a7391/events/live/20110403/regions.php?region=atl","/ug/sea" := "http”,“/a2416/events/live/20100602/regions.php?region=sea","/ug/nyc" := “https”,“/a1753/0524611/live/20100714/regions.php?region=nyc","/ug/la" := "https”,“/a6542/0316327/live/20100312/regions.php?region=la",I am sure that my format is incorrect...but, this might give me some more flexibility if I can reference a couple of different values per key.1 Reply
- hoolio
Cirrostratus
Hi Cindy,
You can do this almost exactly as you have it listed--just combine the two values into one string:
"/ug/atl" := “http,/a7391/events/live/20110403/regions.php?region=atl",
You can then use the class command to get the value:
Get the combined value for $find in the $datagroup
set value [class lookup $find $datagroup]
if {$value ne }{
Use scan to separate the two values
scan $value {%[^,],%s} value1 value2
log local0. "Parsed $value1 and $value2"
}
Aaron
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
