Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Issue with some temporary tables being created

Hi,

I have an issue, seemingly in one piece of my code that goes like this:


SOFA_Liste_v2:
LOAD
     *
From_Field(Temp1, Mat_unsauber)
(
no labels);
// At this point, there should be four records in this table
RENAME FIELD @1 TO Sachnr_und_Anz_$(v_line2);

...

DROP TABLE SOFA_Liste_v2;

At this point (this is the second one of two subroutines being called), there is an error "FieldName already exists", the reason being that there is some table created in an earlier iteration of that subroutine called "SOFA_Liste_v2-1".

I would like to know why that is being created and not dropped and if I can avoid the creation of that clone - or at least delete it.

Thanks a lot!

Best regards,

DataNibbler

12 Replies
datanibbler
Champion
Champion
Author

Hi Martin,

I used your code in my app and now it all runs fine. Thanks a lot for that!

I would like to make it part of our internal "development guidelines" - to make scripts "clean up their act". That's very important in loops as I have experienced - but a sensible thing to do in all situations (I already have a way of removing used variables and removing unnecessary qvd_files).

I haven't yet found out how to modify the code so that one table is left alone and all the others are deleted - for when you need to do an interim_cleaning in the process.

Can you help me there?

Thanks a lot!

Best regards,

DataNibbler

martinpohl
Partner - Master
Partner - Master

Hello DataNibbler,

I modified the script so now you can declare a table which not ne deleted.

in Line 57 in the script you can define it. You can also combine this if statement with more than one table or the number of lines in the table and so on.

Regards

datanibbler
Champion
Champion
Author

-Thanks a lot!

You did it the other way round. That is probably the difference.

I tried to just delete all the tables where the specified tablename (the one to keep) is not encountered. I didn't think of just exiting. I guess I could modify that so that only the loop is exited, not the entire script.

Best regards,

DataNibbler

P.S.: You have TableName(0) there and TableName(1) - would you mind telling me what is the logic  behind that?