Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2004
    Posts
    6

    concatenate variable name

    Hi experts

    I defined some text-variables on project startup
    text_a_1 = "abc";
    text_a_2 = "def";
    text_b_1 = "ghi"; and so on

    then I defined on a page
    V1 = "a";
    V2 = 2;
    disp = "text_"..V1.."_"..V2
    Label.SetText("label1", disp);

    and the result is: text_a_2 and not def

    ??????? HELP ??????????

  2. #2
    Join Date
    Oct 2006
    Location
    London, UK
    Posts
    351
    Quote Originally Posted by fwl View Post
    Hi experts

    I defined some text-variables on project startup
    text_a_1 = "abc";
    text_a_2 = "def";
    text_b_1 = "ghi"; and so on

    then I defined on a page
    V1 = "a";
    V2 = 2;
    disp = "text_"..V1.."_"..V2
    Label.SetText("label1", disp);

    and the result is: text_a_2 and not def

    ??????? HELP ??????????
    Use this code:
    Label.SetText("label1", text_a_2);

  3. #3
    Join Date
    Jun 2004
    Posts
    6
    thanks for the tip, mz241508 but it doe's not solve my problem:

    I want to concatenate the content of some variables to the name of a new variable and display the predefined content of the new variable in a label or paragraph object

    a1 = "some text" (a2, b1, b2, ... are also predefined)
    v1 = "a"
    v2 = 1
    new_var = ?? v1..v2 ?? -- should be a1 and Label.SetText("label1", new_var); should display "some text"

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    its because you have the var in quotes, when concentrating vars do not wrap then in quotes as thay are treated as text by ams


    a1="text1"
    a2="text2"
    a3="text3"
    Label.SetText("label1", a1..a2..a3); = text1text2text3

    or if you want a space between them

    a1="text1"
    a2="text2"
    a3="text3"
    Label.SetText("label1", a1.." "..a2.." "..a3); = text1 text2 text3
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    May 2005
    Posts
    1,115
    Quote Originally Posted by fwl View Post
    Hi experts...
    You can not do that since your output is string and not a variable. Use tables for purposes like this:

    Code:
    text={}
    text["a"]={}
    text["a"][1]="abc";
    text["a"][2]="def";
    text["b"]={}
    text["b"][1]="ghi";
    
    V1 = "a";
    V2 = 2;
    disp = text[V1][V2]
    Label.SetText("label1", disp);
    Last edited by bule; 03-21-2007 at 12:58 PM.
    Never know what life is gonna throw at you.
    (Based on a true story.)

  6. #6
    Join Date
    Jun 2004
    Posts
    6
    Thank's bule
    it's a good idea to use tables, but i fixed the problem in the meantime with a global function where i put all my if - then - else structure and the text strings (so i have to type it only one's) and on the pages where i need the text:
    Label.SetText("label1", setBtxt(v1,v2)); setBtxt is the global function.

Similar Threads

  1. Can't write variable value to log file
    By David Wellman in forum Setup Factory 7.0
    Replies: 4
    Last Post: 01-10-2005, 11:06 AM
  2. how to concatenate a variable
    By gnetcanada in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 12-17-2004, 11:50 PM
  3. problem with variable
    By UweGeercken in forum Setup Factory 6.0
    Replies: 2
    Last Post: 07-12-2004, 04:15 AM
  4. Can't copy files with variable??
    By SonG0han in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 03-06-2004, 03:58 AM
  5. Registry Variable Failure
    By ggallo in forum Setup Factory 5.0
    Replies: 3
    Last Post: 08-30-2001, 01:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts