CSV - Update records if the primary key matches

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
khouse
Posts: 11
Joined: 2019-05-12 14:34

CSV - Update records if the primary key matches

Post by khouse » 2019-09-17 21:26

Hi - There is a setting when importing a CSV that updates values of existing records, which is great. The problem is that you have to check it every time on import. Forgetting to check this value ignores values that are associated with existing keys, meaning basically nothing gets updated. Is there any way to default this to ON so my customer doesn't have issues with forgetting to check it?

Update table records if their primary key values match those in the CSV file.
If not checked, records in the CSV file having the same primary key values as those in the table will be ignored


Thank you - Kirk

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: CSV - Update records if the primary key matches

Post by pbottcher » 2019-09-18 19:19

Hi,

you can edit the hooks/pageUploadCSV.php (remember that this will be overwritten if you regenerate you app).

serach for (around line 540 )

<?php echo $this->lang['update table records'] ; ?>

and update the line

<input type="checkbox" name="update_pk" id="update_pk" value="1" >

to

<input type="checkbox" name="update_pk" id="update_pk" value="1" checked>
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

khouse
Posts: 11
Joined: 2019-05-12 14:34

Re: CSV - Update records if the primary key matches

Post by khouse » 2019-09-18 20:10

That did it, thanks so much! Wish it was a setting but I need to start avoiding the Overwrite All Files options :)

Only thing different is that I found the file in the admin folder. Thanks - Kirk

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: CSV - Update records if the primary key matches

Post by pbottcher » 2019-09-19 06:38

Hi,

glad to see it works. And true it is in the admin folder not in the hooks. :-)
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply