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!
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
put word tStart to tEnd of tText into aFound[x]
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Is that all looking good then, I've just changed where my text is located, "Results2" and the lookup function, on mouseUp. So I've made 5 text boxes called box 1-5 Yes if you could help me put the results into these boxes that would be amazing!
In my "Results 2" box that number appears on a separate line as in
Select item 244094151.
Cloning of Soluble Human Stem Cell Factor in pET-26b(+) Vector.
Asghari S, Shekari Khaniani M, Darabi M, Mansoori Derakhshan S.
Adv Pharm Bull. 2014;4(1):91-5. doi: 10.5681/apb.2014.014. Epub 2013 Dec 23.
PMID:
24409415
However in pubmed the number is right next to word PMID.
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
put word tStart to tEnd of tText into field "Box1"
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Could you tell me where I am I going wrong? Thank so much for all your help so far!
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
## You need to create the names of the target fields inside of the repeat loop:
put word tStart to tEnd of tText into field ("Box" & x)
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Thank you so much I've attached a jpg maybe that will help, do we need to say stop if x>5 as i keep getting an error and there's nothing going in the boxes yet......
The boxes are called Box1, Box2, Box3, Box4 and Box5
on mouseUp
searchForums
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
## You need to create the names of the target fields inside of the repeat loop:
put word tStart to tEnd of tText into field ("Box" & x)
add 1 to x
add tEnd to tSkip
if x>5
end repeat
end mouseUp
command searchForums
set the htmlText of field "Results2" to URL ("#pubmed database (I can't post the link)" & urlEncode(the text of me))
end searchForums
I'm not sure what is going wrong?? I've already burnt a cake and some flapjacks this week trying to figure this out!!
We need to know what the error is. The text in the screenshot doesn't match the data you posted, or at least, not the part that's visible so that may be the reason.
Also, if you know that you want exactly 5 results only then you can change the repeat loop to specify 5 repeats:
repeat with x = 1 to 5
and remove the lines that initialize x and add 1 to it. I'll leave that as an exercise for you. When we know what error you're seeing then we can look at that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Hi Jacque, thank you so much for your message I've simplified the app a little so don't have that problem anymore think its a little beyond my abilities at the moment. Just a couple of questions 1) I've noticed that the search works just fine when I am on my laptop and press the return key however on the mobile this does not work, my code is
on returninField
searchForums
put fld "Results2" into tText
put wordoffset("Results:",tText) into tStart
put wordoffset("[Pubmed]",tText) into tEnd
put word tStart to tEnd of tText into fld "box1"
end returninField
command searchForums
set the htmlText of field "Results2" to URL ("http://www.ncbi.nlm.nih.gov/pubmed/?term=" & urlEncode(the text of me))
end searchForums
returninField
Will I need a search button like google to do this on the mobile as just pressing return doesn't seem to work? If so how would I go about linking my code in the text box to the button?