EXCLUDE DUPLICATE RECORDS FROM AN ARRAY PRIOR TO IMPORTING TO QUICKBASE WITH API_ImportFromCSV
For what I know there are 2 alternatives:
1.- Create a unique record in the array (In the community there are leads on how to do that after reading and parsing the text file), and Import towards a Key field in Quickbase Table.
Thats fine if you don't have to redo all your relations.
2.-
Use API_DoQuery, from a script in the Table you want to Import to, then contrast this query with the array you have from the file you have already read, using Underscore library. In a certain way it is like Excell when you do vertical look ups or you filter using Advanced Filter. Sure most of us do similar things in Excel
All ideas taken from dandiebolt.
My problems:
a.- I don't exactly now which is the Output format of Api_DoQuery: It is an array, It is an object, how data is structured. From my little experience it is a hell of a difference specially when you are a "cut and paste script writer" as myself, first I think in excel then I try to replicate that with script.
b.- Have been reading Underscore.js library, to find a function that does this for me.
So I found one that does exactly what I want
difference_.difference(array, *others)
Similar to without, but returns the values from array that are not present in the otherarrays.
_.difference([1, 2, 3, 4, 5], [5, 2, 10]); => [1, 3, 4]As always I am confused with the correct syntax:Do I have to put in *others the result of Api do query?Do I have to transform in some way the result of Api do query, so that I can put the new Array into *others?
The New array created can be used in Api_ImportFromCSV, or must be transformed in some way.Thanks on advance