Import customer number auto added in csv
I have this code for every new data
'Nº de registro' := max((select Socios).'Nº de registro') + 1;
How to use the code when importing csv?
4 replies
-
@mdomfu ... as a "best practice" .. you should import to a "staging table" ... and then have code / logic that updates the production view. One reason.. you can put your after create trigger logic into a global function.. and then by "code" .. create / populate the table row and call the global function.. :)
-
Thanks for the reply, but I don't understand what you mean...
-
Let us assume you have a table called Master... and a table called Stage.... 'Field A' is the logical key / unique field. Master looks like
And.. after an import, Stage looks like.
On Master.. you have a field called 'Registration Number' .. and you do not want to reuse any number.. so to allow for deleted.. you need to find the max Master Registgration number and add 1 to it for new master rows..
On Stage (or really any table.. ) you have a button called Import All... and after you click this button.. you get a response of what happend..
The code behind the button is.. (I did not bother accounting for a complete row match.. aka .. nothing to do.. )..
And Master now looks like
I imagine there are other strategies.. but this works..
-
WOW! Thanks for the tutorial! It works!
Content aside
- 5 yrs agoLast active
- 4Replies
- 1712Views