Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4

Thread: text to table

  1. #1
    Join Date
    Jan 2006
    Posts
    8

    text to table

    hello. how can i make a string eg

    128;129;258;685;

    into a table

    i am trying to make APMS reat a txt file generated by PHP but i am getting the follwing caracters when APMS downloads the file from my server 㔲㘲㔲㔲㔲㔲㔲㔲 instead of the numbers that i see whern i open the same txt file via the explorer. can someone tell me why this is happening. i made the download mode in APMS binary_mode and text_mode and it happends on both. can someone tell me why this is happening

  2. #2
    Join Date
    Jan 2006
    Posts
    8
    a foot note. the caracters show when the text file is created via php. if i create it with front page or manually everything works fine..

  3. #3
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Quote Originally Posted by aramos
    hello. how can i make a string eg

    128;129;258;685;

    into a table
    Aramos,

    Make your table and assign values like below:

    tMyTable = {128,129,258,685};

    or like this below:

    tMyTable = {};
    tMyTable[1] = 128;
    tMyTable[2] = 129;
    tMyTable[3] = 258;
    tMyTable[4] = 685;

    In the above, the table is named tMyTable. The small "t" indicates it is a table and differentiates with other variables.

    So if you want to insert values into a table like that from anywhere such as a Text File, you use this : tMyTable = Text.ReadToTable ();

    This example takes a Text File that has several lines of data, and each line ONE data only. Then it will assign each line to a ListBox.
    Code:
    -- Read the contents of a text file to a table.
    tContents = TextFile.ReadToTable("AutoPlay\\Docs\\test1.txt");
    nRow =Table.Count(tContents);
    
    -- Add item to ListBox
    if tContents then
        	for i,sValue in tContents do
                    sText = sValue;
                    sData = sValue;
        		ListBox.AddItem("ListBox1", sText, sData);
    	end
    else
    	Dialog.Message("Notice", "NOTHING IN TEXT FILE", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    As you can see in the above, each readable variable value in sValue can be assigned to any new variables for use for any objects in your AMS page.

    Try it. Hope this is useful.
    Last edited by azmanar; 04-18-2006 at 11:42 PM.
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  4. #4
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Sorry missed something in the function. Should be:
    tMyTable = TextFile.ReadToTable();
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

Similar Threads

  1. Replies: 33
    Last Post: 02-02-2007, 12:56 PM
  2. Text File to Table
    By azmanar in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 02-17-2006, 10:56 AM
  3. Example: Loading Paragraph Text Using a Timer
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 7
    Last Post: 11-25-2004, 05:10 PM
  4. Replies: 4
    Last Post: 12-06-2003, 01:17 PM
  5. HOWTO: Display Conditional Text Based Upon a List Box Selection
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-15-2002, 10:54 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