Quantcast
Channel: PTC Community: Message List - Arbortext
Viewing all articles
Browse latest Browse all 3717

Re: how to store data in a file using ACL

$
0
0

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


Viewing all articles
Browse latest Browse all 3717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>