Concatenate String in loop.. SOLVED

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Concatenate String in loop.. SOLVED

Post by snop21 » Fri Feb 21, 2014 9:10 am

Good Day Livecoders,


I will just ask how can I concatenate the result of my loop which is string to the previous result.?

Here's the Idea

I have data from my query (ken1,ken2,ken3,ken4,ken5)

in my loop

I will display it one at a time but I want to put the result into a variable which will be concatenated with the next result.

Here's will look like


Repeat ------- (don't know how to do it exactly so it let's assume this is the loop :)) I have a variable called holder

holder = ken1 ken2 ken3 ken4 ken5 <=========== This is I want to get. Need your help guys.. ! :))

end repeat

any help will be very much appreciated..

Regards

-snop21
Last edited by snop21 on Fri Feb 21, 2014 7:54 pm, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Concatenate String in loop..

Post by Simon » Fri Feb 21, 2014 9:28 am

my query (ken1,ken2,ken3,ken4,ken5)
holder = ken1 ken2 ken3 ken4 ken5
To me this looks like only the comma is replaced with space?
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: Concatenate String in loop..

Post by snop21 » Fri Feb 21, 2014 9:52 am

Hi Simon,


I attached the file. So that you can view it in actual if you have time..

Thanks

-snop21
Attachments
QueryMoBilePick.livecode.zip
(5.57 KiB) Downloaded 260 times

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Concatenate String in loop..

Post by Simon » Fri Feb 21, 2014 10:02 am

While a stack is great, I'm not going to review your code to find where the problem is.

Did you want to tell me?

Look, I'm happy to help but I'm not your code debugger.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Concatenate String in loop..

Post by Thierry » Fri Feb 21, 2014 10:16 am

Hi,

In the dictionary, check and read about:
param, params, paramCount

HTH,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Concatenate String in loop..

Post by Klaus » Fri Feb 21, 2014 2:38 pm

Hi snop21,

hm, you already asked this in another thread 8)

And since this is definitively NOT a Windows specific problem,
I will move this thread to the "Beginner" section.


Best

Klaus

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: Concatenate String in loop..

Post by snop21 » Fri Feb 21, 2014 3:57 pm

Simon,

Sorry. Thank you for the help..:)

Thierry,

Thanks. Will read it. :))

Klaus,

Roger that.. :)) And Sorry..:))

Regards

-snop21

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9665
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Concatenate String in loop..

Post by dunbarx » Fri Feb 21, 2014 4:15 pm

Hi.

Not sure where your problem lies. Is it in how to concatenate? Are you comfortable with creating the repeat loop you need?

If concatenation, are you aware of, for example:

put "abc" after "xyz" (to give "abcxyz")
put "abc" & comma & "xyz" (to give "abc,xyz")
put "abc" & space & "xyz" (to give "abc xyz")

Write back...

Craig Newman

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: Concatenate String in loop..

Post by snop21 » Fri Feb 21, 2014 5:08 pm

Hi dunbarx,

Here's my problem.. :)

I have a data from my database I want to display it using mobilepick, so for me to do that I have to make it like this

==> put "Head" & cr & "Member" into optionList <===================================================================================||
||
My plan is I want to display the data from my query into answer dialog 1st to check if I got it right.. ---> Which I got this right.! Very lucky..! :)) ||
||
2nd is since I was able to get the data from my database and display it one at a time I want it to form it like What I wrote above ================= ||

So that I can use it for mobilepick.. Hope I explain it clearly.. :)) Will attached again the file for you to see it. if you don't mind.. If you just have a time..

Thank you very much..

Regards

-snop21
Attachments
QueryMoBilePick.livecode.zip
(5.57 KiB) Downloaded 242 times

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Concatenate String in loop..

Post by Klaus » Fri Feb 21, 2014 5:19 pm

To quote myself from THE OTHER THREAD:
...
really not sure what your problem is:
Adding QUOTE to every line of your variable?
Turning a CR delimited list into a SPACE delimited list?
...
8)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Concatenate String in loop..

Post by Klaus » Fri Feb 21, 2014 5:35 pm

After a couple of thoughts, the problem may not be one :D

1. "mobilepick" requires at least one parameter -> a CR delimited list
2. The query "select whatever from any_table" will return, you guessed, a CR delimited list of all columns whatever in table any_table! 8)

That means you can use the variable returned form the database query in your "mobilepick" handler without any modification like adding QUOTES!

But maybe I still don't get your problem...

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: Concatenate String in loop..

Post by snop21 » Fri Feb 21, 2014 7:51 pm

Klaus,

You are right klaus.. I dont really need that quote stuffs... I am so stupid.. :(( I am making things so complicated even supposedly it's not.. :((

Thank you klaus..

For this for sure I am going to be better to this PL..! :))

Thank You, Guys.. :))

-snop21

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”