Dear htuser,
Your guidance was very helpful for me.
I developed a simple application for the Main Menu where I have 5 variables: Main_Menu, Clerk_Name, Clerk_Surname, Tablet_Num and HH_Menu.
In the dictionary Main_Menu is the only variable I have in the ID and the remaining variables are in what I called HH_Menu record.
To test the use of "filerename" and how to run the application from a menu, I wrote the below simple code but see what I get as message: ERROR: Invalid function call (comma expected) near line 7 in HH_MENU procedure.
Please, could you help me to solve this issue.
Regards.
PROC GLOBAL
List string fileListing;
numeric i;
PROC MAIN_MENU_FF
PROC MAIN_MENU
If $ = 1 then
Skip to CLERK_NAME;
Else
stop(1);
Endif;
PROC HH_MENU
String dataname = concat(strip(clerk_name), strip(clerk_surname));
Dirlist(fileListing,"D:\Disk E\GANA\FINSCOPE\2015\CAPI","*Data.*");
do i = 1 while i <= length(fileListing)
string fname = fileListing(i);
if pos(dataname, fname) > 0 then;
filerename(fname,"D:\Disk E\GANA\FINSCOPE\2015\CAPI\" + dataname + Tablet_Num + ".dat");
endif;
enddo;
Execpff("../FINSCOPE.pff", wait);
Reenter;
Dynamic change of data file name (Fileexist/Filerename)
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear htuser,
Your guidance was very helpful for me.
I developed a simple application for the Main Menu where I have 5 variables: Main_Menu, Clerk_Name, Clerk_Surname, Tablet_Num and HH_Menu.
In the dictionary Main_Menu is the only variable I have in the ID and the remaining variables are in what I called HH_Menu record.
To test the use of "filerename" and how to run the application from a menu, I wrote the below simple code but see what I get as message: ERROR: Invalid function call (comma expected) near line 7 in HH_MENU procedure.
Please, could you help me to solve this issue.
Regards.
PROC GLOBAL
List string fileListing;
numeric i;
PROC MAIN_MENU_FF
PROC MAIN_MENU
If $ = 1 then
Skip to CLERK_NAME;
Else
stop(1);
Endif;
PROC HH_MENU
String dataname = concat(strip(clerk_name), strip(clerk_surname));
Dirlist(fileListing,"D:\Disk E\GANA\FINSCOPE\2015\CAPI","*Data.*");
do i = 1 while i <= length(fileListing)
string fname = fileListing(i);
if pos(dataname, fname) > 0 then;
filerename(fname,"D:\Disk E\GANA\FINSCOPE\2015\CAPI\" + dataname + Tablet_Num + ".dat");
endif;
enddo;
Execpff("../FINSCOPE.pff", wait);
Reenter;
Your guidance was very helpful for me.
I developed a simple application for the Main Menu where I have 5 variables: Main_Menu, Clerk_Name, Clerk_Surname, Tablet_Num and HH_Menu.
In the dictionary Main_Menu is the only variable I have in the ID and the remaining variables are in what I called HH_Menu record.
To test the use of "filerename" and how to run the application from a menu, I wrote the below simple code but see what I get as message: ERROR: Invalid function call (comma expected) near line 7 in HH_MENU procedure.
Please, could you help me to solve this issue.
Regards.
PROC GLOBAL
List string fileListing;
numeric i;
PROC MAIN_MENU_FF
PROC MAIN_MENU
If $ = 1 then
Skip to CLERK_NAME;
Else
stop(1);
Endif;
PROC HH_MENU
String dataname = concat(strip(clerk_name), strip(clerk_surname));
Dirlist(fileListing,"D:\Disk E\GANA\FINSCOPE\2015\CAPI","*Data.*");
do i = 1 while i <= length(fileListing)
string fname = fileListing(i);
if pos(dataname, fname) > 0 then;
filerename(fname,"D:\Disk E\GANA\FINSCOPE\2015\CAPI\" + dataname + Tablet_Num + ".dat");
endif;
enddo;
Execpff("../FINSCOPE.pff", wait);
Reenter;
Re: Dynamic change of data file name (Fileexist/Filerename)
Please can you attach the application or send it to me by private message? So, i can help you better.
Regards,
Regards,
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear htuser,
Attached is my application.
Regards.
Attached is my application.
Regards.
Re: Dynamic change of data file name (Fileexist/Filerename)
It doesn't work because the menu must be used to write and launch a pff file for another application (a main application). In your file you only have the menu. Please confirm what application you want to launch with the menu. The menu codes will rename data file of this main application,not for the menu itself. Please confirm his availability. Maybe i can write an example and show you, but this will take more times than if you send to me you own file (maybe an example file).
Regards,
Regards,
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Dynamic change of data file name (Fileexist/Filerename)
I assume that you can use any existing application as the main application. In the execpff command you can change my Finscope.pff by the pff file associated to your main application.
I only have a problem with filerename function because when I comment it the program run very well and allow to execute the main application. As long as the folder and files in the code exist, the menu application should run. I don't understand why that error.
Regards
I only have a problem with filerename function because when I comment it the program run very well and allow to execute the main application. As long as the folder and files in the code exist, the menu application should run. I don't understand why that error.
Regards
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear htuser,
As per your request, please find attached application for test.
Sorry to disturb you.
Regards.
As per your request, please find attached application for test.
Sorry to disturb you.
Regards.
- Attachments
-
- TEST.zip
- (26.81 KiB) Downloaded 326 times
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear htuser,
The problem of running the program is now solved. I have made a mistake of defining the variable Tablet_num in the dictionary as numeric instead of string.
Still I have a problem. The command renames the existing file but by adding other questionnaires, we come up with 2 data files: one named using the menu which contains the existing data and another containing data captured by adding other questionnaires.
So, is it possible to continue adding questionnaires in the renamed data file?
Regards
The problem of running the program is now solved. I have made a mistake of defining the variable Tablet_num in the dictionary as numeric instead of string.
Still I have a problem. The command renames the existing file but by adding other questionnaires, we come up with 2 data files: one named using the menu which contains the existing data and another containing data captured by adding other questionnaires.
So, is it possible to continue adding questionnaires in the renamed data file?
Regards
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear Ganas,
I'm very happy that the problem has been solved.
Indeed, I've worked on an example to you (it's attached to this post).
Maybe, my example can solve entirely your problem.
Please let me know if you have more question.
HAITI_USER
I'm very happy that the problem has been solved.
Indeed, I've worked on an example to you (it's attached to this post).
Maybe, my example can solve entirely your problem.
Please let me know if you have more question.
HAITI_USER
- Attachments
-
- Dyn_Rename_data_file.zip
- (15.6 KiB) Downloaded 352 times
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Dynamic change of data file name (Fileexist/Filerename)
Dear Htuser,
Thank you very much. Let me again go through your codes and for sure I'll need more clarification because it is my first time using the menu.
Regards.
Thank you very much. Let me again go through your codes and for sure I'll need more clarification because it is my first time using the menu.
Regards.