SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Concatenate with Arrays

    I have a data file that has 4 columns (for example) of data. I would like to concatenate the data in each cell to make a new column called "New_Data" (for example).

    The for{} statement I have is working fine and capturing the data in an array temp[i].
    for(i=1; i<= 4; i++)
    {
    val = ddt_val(table, "Row_" &i);

    temp[i] = val;
    }

    Only problem is what to do with the data in temp[i] so that I can place it as one string into the "New_Data" column.

    There has to be a more efficient way of doing this than the following:

    ddt_set_val(table, "New_Data", temp[1]&temp[2]&temp[3]&temp[4]);

    I haven't found any good information on concatenation of arrays or if this is even possible.

    Thanks

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Location
    Nashville, TN, USA
    Posts
    713
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Concatenate with Arrays

    You could always just concatenate the string as you go:

    You may also want to look into the 'join' function that's available with the Array Functions created by Ferry Firmansjah. There's more info at this URL: http://www.itechnologist.com/tech/func_ra.html . Using the join function, you could do the following:

    Best of luck!

    ------------------
    Boyd Patterson
    Patterson Consulting Services
    www.patterson-consulting.net
    bpatterson@patterson-consulting.net

    Developing Software Tools to Help WinRunner Automators
    Boyd Patterson
    Patterson Consulting, LLC
    www.patterson-consulting.net

    [i]Creator of Test Design Studio - Powerful IDE for QuickTest Pro[i]

  3. #3
    Senior Member
    Join Date
    Oct 2002
    Location
    Waterloo, Ontario, Canada
    Posts
    151
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Concatenate with Arrays

    Confusion for columns of data or 4 rows of data. I will assume 4 rows of data.

    concatenate to a single string

    for(length of the array) {

    string = string & array[i];

    }

    ddt_set_val(table,"NEW_DATA",string);

    I hope this answers your concern.

    Thanks,




    ------------------
    Samad Siwani
    CS, UW
    Samad Siwani
    CS, UW

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:05 AM.

Copyright BetaSoft Inc.