Implicit value for a column when importing via CSV

QuestionsImplicit value for a column when importing via CSV
Tacitus Kilgore asked 2 years ago

Hello Abu,

I’m developing a Grid whose main purpose is to proccess data imported as CSV. That proccess is working perfectly but I need to add one more functionality:

The user will provide a CSV with the fields “Name” and “Address”, but the database has a third field “City” that has to be automatically filled with a value chosen by the user via a combobox.

So: Let’s say the user chose the City “C”, and it’s value is correctly stored in a PHP variable. Now, for that session, every row that is added with the import tool should contain ‘C’ in the City column. That column was not passed via CSV.

I hope my question is well explained, thanks in advance!

2 Answers
Tacitus Kilgore answered 2 years ago

Just to be clear: I’m wondering if I can implement that functionality directly, or how can I tweak the code of the import tool (step1-step2-step3.php) to make this work. Thanks

Abu Ghufran Staff answered 2 years ago

Hello,

For this purpose we support on_import event where you can have such customizations.

https://www.gridphp.com/demo/demos/export/import.phps Line 50,53

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

18 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?