Question Can I pass blank temp-table value conditionally

Hi,
I would like to pass the temp-table condionally to an external procedure. If SN is blank , no need to pass the temp-table tt-tm-log otherwise I need to pass it. I tried the below code I am getting pramenter mismach error at run time. Any solution for this.

Regards
Philip


IF Temp-Log.SN = '' THEN
RUN ErrorCodes.p ("ALL",
INPUT TABLE-HANDLE Temp-tmLog,
INPUT TABLE-HANDLE ?,
OUTPUT error-codes).
ELSE RUN ErrorCodes.p ("ALL",
INPUT TABLE-HANDLE Temp-tmLog,
INPUT TABLE-HANDLE h-tt-tm-log,
OUTPUT error-codes).
 

Cringer

ProgressTalk.com Moderator
Staff member
It's a cludge, but have you tried having a dummy handle variable you never initialise and send that in in the ELSE part?
 

tamhas

ProgressTalk.com Sponsor
If you encapsulate the logic around the temp-table, then you don't need to pass it anywhere. If you use a class instead of a procedure, then you can have a method with multiple signatures.
 

RealHeavyDude

Well-Known Member
You need to be aware, that with your code you not only pass the Temp-Table around in your session - with each pass you create a copy of it. Therefore, if you then changed the contents of the Temp-Table in one procedure that got it passed in, the calling procedure won't ever notice unless you pass it back out.

The best approach is to encapsulated the Temp-Table in a dedicated class or procedure that makes it accessible to everyone in your session. The second best option is to use BY-REFERENCE ( static reference ) or only the handle to it's default buffer ( TEMP-TABLE myTT:DEFAULT-BUFFER-HANDLE )so that only one copy of the Temp-Table is maintained and all other procedures you pass the handle only get the reference. Obviously that does not work accross the AppServer boundary - but I don't see any AppServer specific syntax in your code anyway.

Heavy Regards, RealHeavyDude.
 
Top