Search and Scrolling List field
Posted: Mon Jan 14, 2019 9:18 am
Right so in the stock app I'm making, I'm trying to make a search bar that, when certain keywords are into the search field and the search button is pressed, it will store the keyword into a variable before substituting it into a search API that will return a .csv file that contains a list of companies and certain details of them and put that into a scrolling list field, with each company and their details returned as individual options. When one of these options are pressed it should substitute the first item of each choice (the company's stock symbol). However, when I enter something a keyword of a company I know exists(in this case its symbol) then it returns nothing into the scrolling list field. Even entering in a single letter, or the company's exact name won't do anything when I try to use the variable of the text of the search field. However when entering a keyword directly into the API through the script instead of using a variable, it returns the .csv file with each line as a choice. I'm pretty sure it's not the API's fault but something to do with language. Could you please tell me whats wrong with it.
My script for the search button where searchField is where the user enters the keyword and choiceField is the scrolling list field.:
global theKeyword
global x
on mouseUp
put the text of field "searchField" into theKeyword
put url(this is where the api would go but forum won't let me put it here.) into x
delete line 1 of x
delete the last char of x
put x into field "choiceField"
end mouseUp
The other problem is I don't know how to select the first item of the selected choice in the scrolling list field. I want to be able to select the first item of whatever option I choose and substitute it into a function. But I get a compilation error at the line where I use 'clickLine' What's wrong with it?
Code for scrolling list field:
on mouseUp
local y
local z
put clickLine of field "choiceField" into z
put item 1 of z into y
call getStock(y) . (function declared in stack so I should be able to call it)
end mouseUp
My script for the search button where searchField is where the user enters the keyword and choiceField is the scrolling list field.:
global theKeyword
global x
on mouseUp
put the text of field "searchField" into theKeyword
put url(this is where the api would go but forum won't let me put it here.) into x
delete line 1 of x
delete the last char of x
put x into field "choiceField"
end mouseUp
The other problem is I don't know how to select the first item of the selected choice in the scrolling list field. I want to be able to select the first item of whatever option I choose and substitute it into a function. But I get a compilation error at the line where I use 'clickLine' What's wrong with it?
Code for scrolling list field:
on mouseUp
local y
local z
put clickLine of field "choiceField" into z
put item 1 of z into y
call getStock(y) . (function declared in stack so I should be able to call it)
end mouseUp