FarahJoyner
8 years agoQrew Trainee
Ignore values when importing from CSV
I am running an API_ImportFromCSV command:
<qdbapi>
<usertoken> EXCLUDED </usertoken>
<records_csv>
<![CDATA[
%RepeatOn%
[Location Code.csv],[Location Description.csv]
%RepeatOff%
]]>
</records_csv>
<clist>13.14</clist>
</qdbapi>
I receive the following error msg.:
<?xml version="1.0" ?>
<qdbapi>
<action>API_ImportFromCSV</action>
<errcode>51</errcode>
<errtext>Trying to add a non-unique value to a field marked unique</errtext>
<errdetail>Your import data has duplicate values for the following unique fields<BR/>
<BR/>
Field name: Location Code<BR/>
Duplicate values:<BR/>
470780</errdetail>
<num_recs_input>63</num_recs_input>
<num_recs_added>0</num_recs_added>
<num_recs_updated>0</num_recs_updated>
<num_recs_unchanged>0</num_recs_unchanged>
</qdbapi>
So, I have designed a webhook that updates my Sites table with data form my Project Code table. What I would like to do is update the sites table whenever an update is made to the Project Codes table. However, several project codes may use the same location code (see below). The result is I will often have duplicate values included in the table I am trying to import into the Sites table, as result the command terminates.
How can I design a means to parse out duplicated location codes from the csv file I want to import into my Sites table? The Project Code and Location Code fields must remain the key fields for their respective tables.
Example Project Code table record:
Project Code*, Project Description, Location Code, Location Description
*table key
Example Sites table record:
Location Code* (fid 13), Location Description (fid 14)
*table key
Each project code record has a location code assigned to it. These location codes, as they are added and modified, should update the Sites table via the API . I import a massive list 10,000 + records provided to me by our client each week and would like to avoid importing
Example Import:
201745846389, Westpoint South AMA , 470780, Westpoint South
201845788857, Westpoint South IDBC, 470780, Westpoint South
201700015000, Mayfield North KRS, 487975, Mayfield North
<qdbapi>
<usertoken> EXCLUDED </usertoken>
<records_csv>
<![CDATA[
%RepeatOn%
[Location Code.csv],[Location Description.csv]
%RepeatOff%
]]>
</records_csv>
<clist>13.14</clist>
</qdbapi>
I receive the following error msg.:
<?xml version="1.0" ?>
<qdbapi>
<action>API_ImportFromCSV</action>
<errcode>51</errcode>
<errtext>Trying to add a non-unique value to a field marked unique</errtext>
<errdetail>Your import data has duplicate values for the following unique fields<BR/>
<BR/>
Field name: Location Code<BR/>
Duplicate values:<BR/>
470780</errdetail>
<num_recs_input>63</num_recs_input>
<num_recs_added>0</num_recs_added>
<num_recs_updated>0</num_recs_updated>
<num_recs_unchanged>0</num_recs_unchanged>
</qdbapi>
So, I have designed a webhook that updates my Sites table with data form my Project Code table. What I would like to do is update the sites table whenever an update is made to the Project Codes table. However, several project codes may use the same location code (see below). The result is I will often have duplicate values included in the table I am trying to import into the Sites table, as result the command terminates.
How can I design a means to parse out duplicated location codes from the csv file I want to import into my Sites table? The Project Code and Location Code fields must remain the key fields for their respective tables.
Example Project Code table record:
Project Code*, Project Description, Location Code, Location Description
*table key
Example Sites table record:
Location Code* (fid 13), Location Description (fid 14)
*table key
Each project code record has a location code assigned to it. These location codes, as they are added and modified, should update the Sites table via the API . I import a massive list 10,000 + records provided to me by our client each week and would like to avoid importing
Example Import:
201745846389, Westpoint South AMA , 470780, Westpoint South
201845788857, Westpoint South IDBC, 470780, Westpoint South
201700015000, Mayfield North KRS, 487975, Mayfield North