Mahmad rafi shaik
New Member
METHOD PUBLIC VOID loadFilesFromDir(INPUT cipDir AS CHARACTER , INPUT iphbufhandle AS HANDLE ):
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFilePath AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFormat AS CHARACTER NO-UNDO.
INPUT FROM OS-DIR (cipDir).
IF OS-ERROR = 0 THEN
DO:
REPEAT :
IMPORT cFile cFilePath.
IF cFile <> "." AND cFile <> ".." THEN
DO:
iphbufhandle:BUFFER-CREATE ().
iphbufhandle::ttFile =cFilePath.
END.
END.
END.
ELSE
MESSAGE "eror at os dir"
VIEW-AS ALERT-BOX.
INPUT CLOSE .
RETURN.
CATCH e AS Progress.Lang.Error:
UNDO, THROW NEW Progress.Lang.AppError(e:GetMessage(1),1).
END CATCH.
END METHOD.
It is a method in my class. Here i want to ensure several things
1. The input directory is valid or not
2. The handle I'm getting temp table handle or not ( i'm passing temp-table:default-buffer-handle from method calling )
3.i want to know which type of file i'm going to import
4.The temp table may have or may not have the ttFile as field how do i can handle it
I'm a beginner help me in a way i can understand the things.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFilePath AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFormat AS CHARACTER NO-UNDO.
INPUT FROM OS-DIR (cipDir).
IF OS-ERROR = 0 THEN
DO:
REPEAT :
IMPORT cFile cFilePath.
IF cFile <> "." AND cFile <> ".." THEN
DO:
iphbufhandle:BUFFER-CREATE ().
iphbufhandle::ttFile =cFilePath.
END.
END.
END.
ELSE
MESSAGE "eror at os dir"
VIEW-AS ALERT-BOX.
INPUT CLOSE .
RETURN.
CATCH e AS Progress.Lang.Error:
UNDO, THROW NEW Progress.Lang.AppError(e:GetMessage(1),1).
END CATCH.
END METHOD.
It is a method in my class. Here i want to ensure several things
1. The input directory is valid or not
2. The handle I'm getting temp table handle or not ( i'm passing temp-table:default-buffer-handle from method calling )
3.i want to know which type of file i'm going to import
4.The temp table may have or may not have the ttFile as field how do i can handle it
I'm a beginner help me in a way i can understand the things.