Forum Discussion

Thanadon_Wattan's avatar
Thanadon_Wattan
Icon for Nimbostratus rankNimbostratus
Feb 16, 2005

how to parse each element in "data group list"

when I use [llength $::data_group_name], an error occurs like this :

 

 

- list element in braces followed by "" instead of space while executing "llength $::CRP_Mapping"

 

 

anyone have any idea, what wrong with my syntax?

 

or have another syntax/function to get element in datagroup. Please help!!

 

 

my data group is 'string' type. thank you.
  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    I think you may be having problems with the underscores. Try putting the name inside braces like this ...
    {::data_group_name}

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    The change you make to a datagroup should be made to the config running in memory, but will not be saved (even by manually running 'b save' to write the config from memory to file).

    Here is an example iRule which shows an element being appended to the list:

     
     when RULE_INIT { 
      
        log local0. "\$::test_class: $::test_class (length: [llength $::test_class])" 
        lappend ::test_class a_new_element 
        log local0. "\$::test_class: $::test_class (length: [llength $::test_class])" 
      
     } 
     

    Log output:

    Rule : $::test_class: item10 item4 item2 item1 (length: 4)

    Rule : $::test_class: item10 item4 item2 item1 a_new_element (length: 5)

    Can you post the actual rule you're testing as well as the logs showing the issue?

    Aaron