Discussions

 View Only
  • 1.  API_ImportFromCSV

    Posted 05-13-2020 10:12
    Can we update and add record using single API_ImportFromCSV api call?

    My requirement is want move record data from table to table by homepage button click.
    If record is already exist in 2nd table we have to update those record if not have add those record.

    Can i do in single API call?

    ------------------------------
    Chethana Shetty
    ------------------------------


  • 2.  RE: API_ImportFromCSV

    Posted 05-13-2020 11:25
    Hi Chethana,

    It is possible when doing an ImportfromCSV for new records and existing records to be updated. The trick of that is the key between the two tables needs to be consistent , there needs to be a unique identifier that they share in order for the API to have the necessary logic to combine records or create a new record. In the ImportfromCSV call you would want to take advantage of the mergeFieldId parameter, you can find more in the help doc for API_ImportfromCSV in our API Guide

    mergeFieldId

    With this parameter, the import uses the field specified as the key, instead of the key field for the table.

    • The merge field must be a unique field, and the specified merge field must contain unique values.

    • Values for the table key and/or record ID field will be ignored from input to prevent data corruption.

    • If the specified merge field uses a formula, and a record cannot be found by its value, a new record will be added if the resulting formula value is a valid value for the field.

    • Record ID or other table key field can be used as the specified merge field.

    • The clist parameter is required if this parameter is used.

    To specify the field, use the field ID, for example:

    <mergeFieldId>10</mergeFieldId>

    For more details, read an article about the parameter on the Quick Base Community site.


    I hope this suggestion is helpful Chethana.

    ------------------------------
    Evan Martinez
    Community Marketing Manager
    Quick Base
    ------------------------------



  • 3.  RE: API_ImportFromCSV

    Posted 05-13-2020 11:41
    Chethana,
    If it is a table to table copy, then you can make a saved table to table copy using Import/ Export) and have a button which will do that API call and refresh the user back to the dashboard.

    I would make this button in any record just to get it to make the code with the URLEncoding for you to copy and paste into a dashboard button.


    var text URLONE = urlroot() & "db/" & [_DBID_Table_name] & "?act=API_RunImport&ID=10;  // set the correct # for the 10.
    var text URLTWO = urlroot() & "db/" & Appid();

    $URLONE
    & "&rdr=" & URLEncocde ($URLTWO)




    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 4.  RE: API_ImportFromCSV

    Posted 05-14-2020 23:37
    Thank you mark for suggestion.

    ------------------------------
    Chethana Shetty
    ------------------------------



  • 5.  RE: API_ImportFromCSV

    Posted 05-14-2020 23:36
    Thank you Evan..It worked fine for me.

    ------------------------------
    Chethana Shetty
    ------------------------------