i am currently developing a function to do some checks...these checks are done in a function (not created by me) which takes a TableTemp as parameter (declared as temporary) - BYVAR.
this function does not does not do any InsModDel instrunctions, so, i was wondering if can i pass a non-temporary record variable to this function...
Moreover, (this is not my case) what would happen if some field is changed within the function, and then after the function, i do a modify on the original table(which is not temporary)? -i think the table is modified according to the modified field, but i'm not sure-
I hope to be clear, and I hope there's not such a question in mibuso because i don't know what to search :whistle:
thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog 0
Answers
You mean that the Temporary property is set on the parameter? I don't think it matters since you are passing ByVAR. If your original record that was passed as a parameter was declared as temp then ok. I think in this case if you call modify it will affect the original record. And you can pass it even if it isn't temporary. Have you tried an example to see the result?
P.S. I think in Version 2009 there is a nice change in the Rec.COPY function. Maybe this helps you ...
(From C/Side Reference)...
Copies a record from a C/SIDE table. All filters, marks, and keys are included in the copy.
Record.COPY(FromRecord [, ShareTable])
Parameters
Record
Type: Record
The record where the copy will be placed.
FromRecord
Type: Record
The record that you want to copy.
ShareTable
Type: Boolean
Specifies whether the function creates a copy of the record or creates a reference to a temporary record.
If FromRecord and Record are both temporary and ShareTable is true, then the COPY function does not create a new copy of the record. Instead, the COPY function causes Record to reference the same table as FromRecord.
The default value is false. If you specify false, all records are copied to Record from FromRecord.
didn't know about rec.copy new parameter...it is like doing isn't it?
Thank you
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
So, for example you send the Item rec to you function. There you change the Description of Item 1000 from "Colour, blue" to "My colored bike", then in table 27 the item 1000 has the description "My colored bike".
This is the reason for the VAR flag (Call by reference). You work not on a copy of the rec, you work on the rec self.
In call-by-reference evaluation, a function receives an implicit reference to the argument, rather than a copy of its value. And this is here you real rec.
Regards.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog