Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Posts
    52

    Use a variable in a table

    Hi, Im trying to make a search with AMS to collect the results.

    Im using the funcion HTTP.Submit, and the values must be stored in a TABLE (not into a string).

    I don't know what is the method or the syntax that I must use to set a variable as a value on the table.

    My variable is keyWORDS:

    if I use myvalues = {q=keyWORDS}; I haven't got any result.

    if I use myvalues = {q="keyWORDS"}; It search "keyWORDS"

    keyWORDS = Input.GetText("Input1");
    myvalues = {q=keyWORDS};
    sResult = HTTP.Submit("http://www.searchengine.com/search.php", myvalues, SUBMITWEB_GET, 20, 80, nil, nil);


    If somebody knows a solution please tell me

  2. #2
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by nicoh View Post
    Hi, Im trying to make a search with AMS to collect the results.

    Im using the funcion HTTP.Submit, and the values must be stored in a TABLE (not into a string).

    I don't know what is the method or the syntax that I must use to set a variable as a value on the table.

    My variable is keyWORDS:

    if I use myvalues = {q=keyWORDS}; I haven't got any result.

    if I use myvalues = {q="keyWORDS"}; It search "keyWORDS"

    keyWORDS = Input.GetText("Input1");
    myvalues = {q=keyWORDS};
    sResult = HTTP.Submit("http://www.searchengine.com/search.php", myvalues, SUBMITWEB_GET, 20, 80, nil, nil);


    If somebody knows a solution please tell me
    All code that you want is in the Go button.

  3. #3
    Join Date
    Mar 2006
    Posts
    61
    Quote Originally Posted by nicoh View Post
    Hi, Im trying to make a search with AMS to collect the results.

    Im using the funcion HTTP.Submit, and the values must be stored in a TABLE (not into a string).

    I don't know what is the method or the syntax that I must use to set a variable as a value on the table.

    My variable is keyWORDS:

    if I use myvalues = {q=keyWORDS}; I haven't got any result.

    if I use myvalues = {q="keyWORDS"}; It search "keyWORDS"

    keyWORDS = Input.GetText("Input1");
    myvalues = {q=keyWORDS};
    sResult = HTTP.Submit("http://www.searchengine.com/search.php", myvalues, SUBMITWEB_GET, 20, 80, nil, nil);


    If somebody knows a solution please tell me
    Code:
    -- initialize our table
    local myvalues = {};
    
    -- get keywords from user input: using 'tostring' on functions that return strings is too redundant and not necessary.
    local keyWORDS = Input.GetText("Input1");
    
    -- At this point it is a good idea to check user input and perform accordingly
    If (keyWORDS == "") then return; end -- basic check
    
    -- store value in table: can also be done like; myvalues["q"] = keyWORDS;
    myvalues.q = keyWORDS;
    
    -- get search results: NOTE: Use this way if you want to get output of the search results for use in a file or something of the like
    local sResult = HTTP.Submit("http://www.searchengine.com/search.php", myvalues, SUBMITWEB_GET, 20, 80, nil, nil);
    
    -- To actually show the results of the search in a Web object in your application you first need to build your URL using your myvalues table.
    -- Build our URL
    local sURL = "http://www.searchengine.com/search.php?"..myvalues.q;
    
    -- Load the URL with an web object
    Web.LoadURL("WebObjectName", sURL);

  4. #4
    Join Date
    May 2007
    Posts
    52
    Thanks for the quick answer. Ill try both methods.

Similar Threads

  1. Fading effect with Labels
    By autoplmst6 in forum AutoPlay Media Studio 7.5 Examples
    Replies: 3
    Last Post: 04-09-2008, 03:18 PM
  2. Associative table index using a variable?
    By Buffman in forum AutoPlay Media Studio 6.0
    Replies: 5
    Last Post: 01-12-2007, 12:17 PM
  3. How do I address a table whose name I know only as a variable?
    By JimS in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 08-24-2005, 07:37 AM
  4. string / table compare
    By gabrielfenwich in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 01-29-2005, 11:30 PM
  5. Creating a Table of Contents
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts