Sadhunathan Nadesan a �crit : > > How do you join lines in a container? > > Question: I have a container which contains an sql cursor, ie, a number > of lines of data (in this case 2 fields separated by the pipe symbol). > I want to place this in an indexed array so I can use it in a replacement > algorithm. Whenever the index field (field 1) is found in some data, > replace it with the indexed field (field 2). > > So, I want to use the split command to create this array, but trying to > split on return, or newline, or cr, or numToChar(10) ... this is a Unix > system .. does not work. > > Therefore I tried to replace the end of line character with something > else in the container so I could do this split. The "=" symbol. > > That did not work either. > > So I came up with the hokey method below .. putting the data out into an > external file and basically running a tr on it to replace the newlines > with =, then reading it back in to do the split. Seems pretty hokey to > me, why can't I just do it in place? Read in the sql data directly and > split it? No external files. But that does not seem to work. > > Oh well, thanks in advance for any help. > > Sadhu > > ps, code snippet below illustrating hokey solution. > > on sqlFetch > > put "select audio_date, audio_url from audio;" into sqlQuery > put sqlQuery into url "file:/tmp/titlelist.sql" > put "psql cybertalks -qt -f /tmp/titlelist.sql > /tmp/titlelist.dat" into > command_string > > set shellCommand to "/bin/sh" > put shell(command_string) > replace numToChar(10) with "=" in url "file:/tmp/titlelist.dat" > put url "file:/tmp/titlelist.dat" into sqlData > split sqlData by "=" and "|" > put keys(sqlData) into keywords > repeat for each line x in keywords > put x && " :---: " && sqlData[x] & cr > end repeat > > end sqlFetch > _______________________________________________ > metacard mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/metacard
Allo Sadhu, > set itemdel to "|" > tune your metatalk code -- Cordialement, Pierre Sahores Inspection acad�mique de Seine-Saint-Denis. Applications et bases de donn�es WEB et VPN Qualifier et produire l'avantage comp�titif _______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
