putting data into a table

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
tempj
Newbie
Posts: 2
Joined: Sat Sep 26, 2009 6:29 pm

putting data into a table

Post by tempj » Sat Sep 26, 2009 6:52 pm

Hey guys,
I am new to MS. I've been trying to add string into a table, something like

--------------------------------------
url | http://domain.com |
--------------------------------------
time | 2009-09-22 14:20:05 |
--------------------------------------

Here is my sample script. I would like to know if there is any other efficient way to retrieve data.

Let>strHTML={"url: http://domain.com, time: 2009-09-22 14:20:05}"

//remove opening bracket {"
Let>pattern={"
RegEx>pattern,strHTML,1,matches,new,1,,strHTML2

//remove closing bracket, "}
Let>pattern="}
RegEx>pattern,strHTML2,1,matches,new,1,,strHTML3

MessageModal>strHTML3


Thanks in advance.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Sep 28, 2009 7:54 am

If I've understood you correctly you want to end up with two rows, and two columns and in this case the columns are split by the ": " and rows by ",". So we could do:

Code: Select all

let>html=
Let>comma=,
Let>str=url: http://domain.com, time: 2009-09-22 14:20:05
Separate>str,comma,rows
Let>html=<TABLE>
If>rows_cout>0
  Let>r=0
  Repeat>r
    Let>r=r+1
    Let>html=%html%<TR>
    Separate>rows_%r%,: ,cols
    If>cols_count>0
      Let>c=0
      Repeat>c
        Let>c=c+1
        Let>this_cell=cols_%c%
        Let>html=%html%<TD>%this_cell%</TD>
      Until>c=cols_count
    Endif
    Let>html=%html%</TR>
  Until>r=rows_count
Endif
Let>html=%html%</TABLE>

MessageModal>html
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tempj
Newbie
Posts: 2
Joined: Sat Sep 26, 2009 6:29 pm

Post by tempj » Tue Sep 29, 2009 12:59 am

thanks much.

Very helpful to understand the basic route.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts