[on-rev]Line endings for a db query
I have a script that is a repeat loop that gets the results of a database query which has a number of lines and puts it after a variable tSamplelist. I then use that variable tSampleList to display data on the webpage by iterating through the lines in the variable. However for each iteration of the original repeat loop the first line of data from the next query is appended to the last line of the tSamplelist and not put on a new line. I tried adding a return after each query but that creates a new blank line. Is there a character I can add after the query that will end the line so the next query will be added on a new line? Thanks. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526068.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Martin, Here's my guess as to what is happening. On the web page you need a br to start a new line. Perhaps the return that you appended to your data is not getting translated into a br before it is put onto the web page. Mike --- On Mon, 4/2/12, Martin Koob mk...@rogers.com wrote: From: Martin Koob mk...@rogers.com Subject: [on-rev]Line endings for a db query To: use-revolut...@lists.runrev.com Date: Monday, April 2, 2012, 8:47 AM I have a script that is a repeat loop that gets the results of a database query which has a number of lines and puts it after a variable tSamplelist. I then use that variable tSampleList to display data on the webpage by iterating through the lines in the variable. However for each iteration of the original repeat loop the first line of data from the next query is appended to the last line of the tSamplelist and not put on a new line. I tried adding a return after each query but that creates a new blank line. Is there a character I can add after the query that will end the line so the next query will be added on a new line? Thanks. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526068.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Hi Micheal. Thanks for the suggestion. However the problem was occurring before I added the markup text to the data. I have found a way to work around it. I am using revDatafromQuery to do the query and I am using LF as the row delimiter. in the repeat loop I put the data returned and an LF after variable tSamplesList. then I delete the last line of tSamplesList. This way on each pass through the repeat loop the new data from the query is added starting on a new line and there are not blank lines in the variable tSamplesList. I also have to put a condition to test if it is the last iteration of the repeat loop. If so then don't delete the last line otherwise you lose the last record from the final query. So it seems that revDatafromQuery does not put an LF on the last line returned from a query. Is there another way to add the correct character at the end of the query to generate a new line in the variable? Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526210.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Actually I typed too soon. adding a LF or a return after tSamplesList variable then deleting the last line actually deletes the last record from the query in the tSamplesList variable. Back to square one. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526238.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
So in the end I just added the LF after the query data from each query which created extra lines in the variable but then when I used the data I just checked if the line was empty and did not use that line. This is just a work around. Does anyone have any suggestions as to how to add several queries after a variable ensuring that each record is on a separate line? Thanks. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526295.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Try if tvar is empty then put stuff into tvar else put return stuff after tvar end ig On Apr 2, 2012 8:13 AM, Pete Haworth p...@haworths.org wrote: Line delimiters are squirly! Try this pseudo code: if tvar is empty then Put stuff into tvar else put return stuff after tvar end if If you can tell its the fitst time thru your loop, you can check for that instead of tvar empty. Pete On Apr 2, 2012 7:49 AM, Martin Koob mk...@rogers.com wrote: Actually I typed too soon. adding a LF or a return after tSamplesList variable then deleting the last line actually deletes the last record from the query in the tSamplesList variable. Back to square one. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526238.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
I just checked to see what revDataFromQuery uses for a row delimiter by default, if you do not provide one. It returns ascii 10, the backspace character! Very odd. Must be an HTML thingummy. I then specified comma and cr as the column and row delimiters like so: put revDataFromQuery(comma,cr,theConnID,select * from events) cr into theSQLData put revDataFromQuery(comma,cr,theConnID,select * from clients) cr after theSQLData This produced NO extra line that I could see. If you still get an extra line using this method, I suspect you have a blank record in your table. Bob On Apr 2, 2012, at 10:57 AM, Martin Koob wrote: Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Hi Martin, That's strange. I just tried the following test: put revDataFromQuery(,,gDBID,SELECT * FROM t1) into tVar put return revDataFromQuery(,,gDBID,SELECT * FROM t1) after tVar tVar looked just like it should after the above, no blank lines. Are you using the default rowdelim character for revDataFromQuery? What platform are you on? My test was done on a Mac. Pete On Mon, Apr 2, 2012 at 10:57 AM, Martin Koob mk...@rogers.com wrote: Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Do you mean decimal 10 or octal 10? Decimal 10 is newline (which is what I'd expect), octal 10 is backspace. Pete On Mon, Apr 2, 2012 at 12:05 PM, Bob Sneidar b...@twft.com wrote: I just checked to see what revDataFromQuery uses for a row delimiter by default, if you do not provide one. It returns ascii 10, the backspace character! Very odd. Must be an HTML thingummy. I then specified comma and cr as the column and row delimiters like so: put revDataFromQuery(comma,cr,theConnID,select * from events) cr into theSQLData put revDataFromQuery(comma,cr,theConnID,select * from clients) cr after theSQLData This produced NO extra line that I could see. If you still get an extra line using this method, I suspect you have a blank record in your table. Bob On Apr 2, 2012, at 10:57 AM, Martin Koob wrote: Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Reference my post. I think he may have a blank row in his database. Bob On Apr 2, 2012, at 12:12 PM, Pete wrote: Hi Martin, That's strange. I just tried the following test: put revDataFromQuery(,,gDBID,SELECT * FROM t1) into tVar put return revDataFromQuery(,,gDBID,SELECT * FROM t1) after tVar tVar looked just like it should after the above, no blank lines. Are you using the default rowdelim character for revDataFromQuery? What platform are you on? My test was done on a Mac. Pete On Mon, Apr 2, 2012 at 10:57 AM, Martin Koob mk...@rogers.com wrote: Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [on-rev]Line endings for a db query
Whoops! My bad yes it's dec 12 newline. I just assumed in a list of that nature on a web site the first column would be the one the majority of people care about. :-) Bob On Apr 2, 2012, at 12:16 PM, Pete wrote: Do you mean decimal 10 or octal 10? Decimal 10 is newline (which is what I'd expect), octal 10 is backspace. Pete On Mon, Apr 2, 2012 at 12:05 PM, Bob Sneidar b...@twft.com wrote: I just checked to see what revDataFromQuery uses for a row delimiter by default, if you do not provide one. It returns ascii 10, the backspace character! Very odd. Must be an HTML thingummy. I then specified comma and cr as the column and row delimiters like so: put revDataFromQuery(comma,cr,theConnID,select * from events) cr into theSQLData put revDataFromQuery(comma,cr,theConnID,select * from clients) cr after theSQLData This produced NO extra line that I could see. If you still get an extra line using this method, I suspect you have a blank record in your table. Bob On Apr 2, 2012, at 10:57 AM, Martin Koob wrote: Hi Peter Thanks, I just tried your suggestion. That still inserts blank lines into the variable that I have to filter out later. It seems the revDataFromQuery does not insert an end of line character after the last record and it seems that the end of line character that is used to separate lines in the variable is not the same as the return or LF constants in LiveCode. Martin -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-Line-endings-for-a-db-query-tp4526068p4526757.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode