• Hi!

    How could I add values from text field to list so that if the variable is REAL like !!x = 3, typing !!x in the text field would add 3 as string to the list.
    If its an array it would add the array contents to the list, etc with dbref and so on.
    So the form could add its own variables values to the list like if the form had like: member .x is REAL, member .arr is ARRAY.

    text .txt1 width 25 is STRING
    list .list1 width 35 height 20
    button .but1 |Add List| call |!this.addList()|

    define method .addList()

     !myadd = $!this.txt1.val
     !this.list1.add(!myadd)

    endmethod


    Something a bit like this. The variable you want to add to the list is written on the text field.
    Managed to get arrays in the list but have problems indentifying and adding others variable types.

    Thanks for any help!
  • Hi Metzger !

    You just have to convert your value to a string (!var.string()) to be able to add it to your list.
    You can manage the specific cases of types, such as Arrays, using the ObjectType() method and then doing special processing.

    Here is a simple example:


    !value = $!this.txt1.val
    If !value.objectType() EQ 'ARRAY' Then[INDENT]Do !valueMember values !value[/INDENT]
    [INDENT=2]!this.list1.add(!valueMember.string())[/INDENT]
    [INDENT]Enddo[/INDENT]
    Else[INDENT]    !this.list1.add(!value.string())[/INDENT]
    Endif
  • Thanks L!

    I tried converting it to string before but prolly me having that dollar sign in front of the line didn't help.