Cardbox Talk


CardboxForumsCardbox Talk > "Cardbox "Fields" content for searching web sites"

Cardbox "Fields" content for searching web sites

When using (in a macro) "http://website/" & Fields ("FieldName") to search a website database, how can I specify to only use say the 1st word/string in "FieldName" not all of them?

Posted By Post

Chris H

26-Jul-2017 06:36

Example: Launch "http://rruff.geo.arizona.edu/AMS/result.php?mineral=" & Fields ("SPNA"); this works fine as long as there is only one word in field ("SPNA")if there are two or more then the rruff website does not find the page being searched for and defaults to the home page. I thing I need to somehow specify to Cardbox ("SPNA") to only put out the first word, of what may occasionally be several, some indexed and other not. Any suggestions???


26-Jul-2017 09:25

I suppose that the strings in fields SPNA are separated by a space?
If you want only first term then is this a solution:
'make an array of all or one term(s) in field SPNA - split position = a space
t = Split(Fields("SPNA"), " ")
'lauch address & first term in array t
Launch "http://rruff.geo.arizona.edu/AMS/result.php?mineral=" & t(0)

It could be you mistyped something and your first character in your field is a space. In that case t(0) is empty.

You can also this correct in the macro by using this:
t = Split(trim(Fields("SPNA")), " ")
Launch "http://rruff.geo.arizona.edu/AMS/result.php?mineral=" & t(0)

© 2010 Cardbox Software Limited   Home