Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have to calculate a field's value and want to store the result to the same field: How could this be done without having to do a second load within a temp tabel (and have to define all fields)? This solution dows mena a lot of (nearly) double coding.
A coding like :
Items_From_DBase:
NoConcatenate LOAD *,
SubField([Level1.Naam],';',1) AS Level1.Naam,
SubField([Level2.Naam],';',1) AS Level2.Naam,
APPLYMAP('mapSwapKEY',RangeMax(NIVO1_ID,NIVO2_ID,NIVO3_ID),null()) as > New_KEY
Resident TreeBuilding;
Drop Table TreeBuilding;
... that exacly show what I intend to do, would result in an error because the field names should be unique. Maybe there is a way of explicit reuse a field's name?
What should be referred to as 'best practice" without having to explicit list all available fields.
Thanks in advance.
Andries Bos, The Netherlands
Hi Andries,
Although I'd specify all fields except for those that you are going to recreate, it's always cleaner and reflects more accurate the fields you are already loading, but you can always do a RENAME FIELD before the second load, so assuming your script
RENAME FIELD Level1.Naam TO Level1.Naam.Temp;
RENAME FIELD Level2.Naam TO Level2.Naam.Temp;
Items_From_DBase:
NoConcatenate LOAD *,
SubField([Level1.Naam.Temp],';',1) AS Level1.Naam,
SubField([Level2.Naam.Temp],';',1) AS Level2.Naam,
APPLYMAP('mapSwapKEY',RangeMax(NIVO1_ID,NIVO2_ID,NIVO3_ID),null()) AS New_KEY
Resident TreeBuilding;
Drop Table TreeBuilding;
DROP FIELDS Level1.Naam.Temp, Level2.Naam.Temp;
Then DROP the original fields no longer in use.
Hope that helps.
Miguel
Hi Andries,
Although I'd specify all fields except for those that you are going to recreate, it's always cleaner and reflects more accurate the fields you are already loading, but you can always do a RENAME FIELD before the second load, so assuming your script
RENAME FIELD Level1.Naam TO Level1.Naam.Temp;
RENAME FIELD Level2.Naam TO Level2.Naam.Temp;
Items_From_DBase:
NoConcatenate LOAD *,
SubField([Level1.Naam.Temp],';',1) AS Level1.Naam,
SubField([Level2.Naam.Temp],';',1) AS Level2.Naam,
APPLYMAP('mapSwapKEY',RangeMax(NIVO1_ID,NIVO2_ID,NIVO3_ID),null()) AS New_KEY
Resident TreeBuilding;
Drop Table TreeBuilding;
DROP FIELDS Level1.Naam.Temp, Level2.Naam.Temp;
Then DROP the original fields no longer in use.
Hope that helps.
Miguel
Hi ,
If you want to retaiin the original field then please use different name for new fileds.
Regards
Vijay
Rename field and drop fields would do the trick, I think; although a solution like
SubField([Level1.Naam],';',1) AS OverwriteField Level1.Naam, would be handy.. Maybe in a next release...
I'm used to program in an OO environment : this scripting is sometimes still a small puzzle to solve.
Hi Andries,
You're welcome, and please take some time to place your suggestions for new features in the Ideas so everybody can vote them and comment them if they feel like.
Regards.
Miguel