0

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

null
    • Mconneen
    • 5 yrs ago
    • Reported - view

    @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.. :) 

    • mdomfu
    • 5 yrs ago
    • Reported - view

    Thanks for the reply, but I don't understand what you mean...

    • Mconneen
    • 5 yrs ago
    • Reported - view

    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 

    master

    And.. after an import, Stage looks like. 

    stage

    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.. 

    results

     

    The code behind the button is.. (I did not bother accounting for a complete row match.. aka .. nothing to do.. ).. 

    theCode

     

    And Master now looks like 

    master 2

     

    I imagine there are other strategies.. but this works.. 

    • mdomfu
    • 5 yrs ago
    • Reported - view

    WOW! Thanks for the tutorial! It works!

Content aside

  • 5 yrs agoLast active
  • 4Replies
  • 1711Views