I am using a function in my program to pass a filename variable to a field, but i need to pass it to several fields. I know I could repeat the function for each variable but I also know that I can change where the variable is placed.
Here is the code ;
STATIC FUNCTION FileName
LOCAL cDir := ALLTRIM(CURDIR())
LOCAL cApp := ""
cApp := cGetFile( "*.rpt","Report Files",1,cDir)
IF cApp == "*.rpt"
cApp := "default"
ELSE
IF "\"$cApp
cApp := ALLTRIM(subst(cApp , rat("\",cApp)+1,12))
cApp := LEFT(cApp, LEN(cApp) - 4)
ENDIF
ENDIF
IF !Empty(cApp)
mReportID := Alltrim(cApp)+".rpt"
oReportID:Refresh()
ENDIF
RETURN NIL
What I need to know is, how can I tell my program to change where the outcome is stored without rewriting it for each variable?