Skip to main content
1-Visitor
August 12, 2015
Solved

how to store data in a file using ACL

  • August 12, 2015
  • 2 replies
  • 5600 views

HI,

     Can any one please help on how to store values in an external file using ACL, I have developed a dialog box window which contains combo box,drop down list, check boxes and other list variable and I want to store the assigned values to some file so that I can get and set same values when I load the document.

Thanks,

Prashant

    Best answer by ClayHelberg

    Hi Prashant--

    If you are getting duplicates, the first thing I would check would be to make sure you are not appending to an existing file when you should be creating a new file. If that checks out, then make sure you don't have a bug that causes your write code to get called more than once.

    If you can have multiple copies in the data source, but only want to write each value once, then you'll have to do your own tracking in the ACL code to check each value before writing it. If it's just individual values you want to keep unique, you could create an associative array to track which ones have been written so you don't write them again. It would look something like this:

    function write_unique(values[]) {

    # open file, etc. omitted for brevity

    # array for tracking used values

    local used_values[];

    local v;

    for (v in values) {

       if (values[v] in used_values) {

         continue;

       }

       else {

         # this is a new one, write it to the file

         put(myfile, values[v]);

         # add it to the used values list

         used_values[values[v]] = 1;

      }

    }

    --Clay

    2 replies

    18-Opal
    August 12, 2015

    Hi Prashant--

    You can use the open(), put(), and close() functions to write information to external files in ACL. Or, if you prefer to save in XML format, you can use doc_open() and insert_tag() to create a new XML document in memory, which you can then save using either doc_save() or the write command. The online help should give you what you need to make these functions work.

    --Clay

    prao1-VisitorAuthor
    1-Visitor
    August 13, 2015

    Thanks Clay, I will go through that. Thank you very much.

    Regards,

    Prashnt

    prao1-VisitorAuthor
    1-Visitor
    August 17, 2015

    HI Clay,

                I got the details how to write to the external file on Help Center, your valuable suggestion helped me a lot, thanks, with this I able to write to the .txt file if I want to write to the same to *.csv or excel file is there any way to do that by calling any function. I have gone mean while for the same in help center I couldn't able to find,

    Thanks,

    Prashant

    5-Regular Member
    September 11, 2015

    Hi Prashant,

    Can you confirm is Clay's input was able to get you through this issue?

    If so, feel free to mark his answer as "Correct".  Thanks!

    prao1-VisitorAuthor
    1-Visitor
    September 14, 2015

    Hi Rafael,

                  The syntax and explanation given by Clay helped me a lot, in addition to that I have done some extra according my requirement , Thanks to Clay for giving gr8 explanation to follow the syntax for my logic to implement. Thanks Rafael,

    With Regards,

    Prashant Rao