Field references in common functions (1 reply and 1 comment)
Use the GetValue function instead.
Function Create_GL_Code(sType) Dim sCode Select Case Lookup("Trans1","FLD02", GetValue("transaction_type_id") , true) Case "01" sCode = Lookup("Defaults","FLD01",1,true) & "." & GetValue("client_id") Case "02" sCode= Lookup("Defaults","FLD02",1,true) End Select Create_GL_Code = sCode End Function
That's wonderful. I never thought of trying it that way
Thanks.
As far as I understand, field references (eg: %cust_id) can't be used in common function script.
If that's correct, does anyone have suggestions on storing code snippets for re-use as functions where field references are required in the code?
A simplified example of a required function is
Function Create_GL_Code(sType)
Dim sCode
Select Case Lookup("Trans1","FLD02",%transaction_type_id,true)
Case "01" sCode = Lookup("Defaults","FLD01",1,true)&"."&%client_id
Case "02" sCode= Lookup("Defaults","FLD02",1,true)
End Select
Create_GL_Code = sCode
End Function