Learjet 27 Posted January 20, 2016 Report Share Posted January 20, 2016 I'm trying to figure out a way to do a data-merge (Spintax with table) with Ubot and I'm kind of stumped! So far, while tedious, I got a killer app going and this is one of the last pieces. Here's the Spintax example: {{I saw|I found|My wife noticed} {a great piece|an article|a writeup} on a [Year] [Car], it was {a beautiful|an amazing|a brilliant} [Color]{ and| &|,} [Car-Company] was {doing everything right|on-point} {at the time,|then,} {check it out|here's the article}: [Article]}}Here's what the table would look like: Year,Car,Color,Car-Company,Article 1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article 1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article I need to figure out how to merge the Spintax file with the table. The output with the above Spintax merged with the table would look like this:I found a great piece on a 1967 Mustang, it was a beautiful Candy Apple Red & Ford was on-point at the time, here's the article: http://ford.com/mustang-articleMy wife noticed an article on a 1969 Camaro, it was a brilliant Canary Yellow and Chevrolet was doing everything right then, check it out: http://chevy.com/camaro-article Suggestions? Many Thanks!LJ Quote Link to post Share on other sites
darryl561 177 Posted January 20, 2016 Report Share Posted January 20, 2016 Might not be the best way but this will work create table from text(&cars,"Year,Car,Color,Car-Company,Article 1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article 1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article") set(#year,$table cell(&cars,$rand(1,2),0),"Global") set(#car,$table cell(&cars,$rand(1,2),1),"Global") set(#color,$table cell(&cars,$rand(1,2),2),"Global") set(#company,$table cell(&cars,$rand(1,2),3),"Global") set(#article,$table cell(&cars,$rand(1,2),4),"Global") set(#example,$spin("\{\{I saw|I found|My wife noticed\} \{a great piece|an article|a writeup\} on a {#year} {#car}, it was \{a beautiful|an amazing|a brilliant\} {#color}\{ and| &|,\} {#company} was \{doing everything right|on-point\} \{at the time,|then,\} \{check it out|here\'s the article\}: {#article}\}"),"Global") load html(#example) Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 20, 2016 Report Share Posted January 20, 2016 Might not be the best way but this will work This will randomize each row number which is not good because you can get an output like this (notice the Ford in there): My wife noticed a writeup on a 1969 Camaro, it was an amazing Canary Yellow & Ford was on-point at the time, check it out: http://chevy.com/camaro-article Instead you would loop through the table since you don't want to randomize that information but the spintax and use all the information once I'm guessing. clear table(&cars) create table from text(&cars,"1967,Mustang,Candy Apple Red,Ford,http://ford.com/mustang-article 1969,Camaro,Canary Yellow,Chevrolet,http://chevy.com/camaro-article") set(#table_row,0,"Global") loop($table total rows(&cars)) { set(#year,$table cell(&cars,#table_row,0),"Global") set(#car,$table cell(&cars,#table_row,1),"Global") set(#color,$table cell(&cars,#table_row,2),"Global") set(#company,$table cell(&cars,#table_row,3),"Global") set(#article,$table cell(&cars,#table_row,4),"Global") set(#example,$spin("\{\{I saw|I found|My wife noticed\} \{a great piece|an article|a writeup\} on a {#year} {#car}, it was \{a beautiful|an amazing|a brilliant\} {#color}\{ and| &|,\} {#company} was \{doing everything right|on-point\} \{at the time,|then,\} \{check it out|here\'s the article\}: {#article}\}"),"Global") increment(#table_row) load html(#example) wait(3) } Quote Link to post Share on other sites
Learjet 27 Posted January 20, 2016 Author Report Share Posted January 20, 2016 Thanks for your suggestion darryl561 however, as HelloInsomnia mentioned it would cause an issue with the car makes getting randomized which would make the article off topic but I sincerely appreciate your efforts! HelloInsomnia, thanks man! Going to give that one a go :-) I'll report back in a few hours :-) Thanks again to both of you! Peace,LJ Quote Link to post Share on other sites
Learjet 27 Posted January 22, 2016 Author Report Share Posted January 22, 2016 Helloinsomnia, Is there any way that you can yak on Skype for a few minutes tomorrow? I got your example working however I'm having a hard time figuring it out when I only have 1 column of links. You can get me at your pleasure: ej.lear Thanks man! Peace,LJ Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 22, 2016 Report Share Posted January 22, 2016 Helloinsomnia, Is there any way that you can yak on Skype for a few minutes tomorrow? I got your example working however I'm having a hard time figuring it out when I only have 1 column of links. You can get me at your pleasure: ej.lear Thanks man! Peace,LJ Sorry but I don't use Skype, you can PM me here though and I'll help you out! Quote Link to post Share on other sites
Learjet 27 Posted January 23, 2016 Author Report Share Posted January 23, 2016 Sorry but I don't use Skype, you can PM me here though and I'll help you out! Sent you a pm :-) Peace,LJ Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.