Page 2 of 3

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 3:09 am
by Ganas
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;

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 3:59 am
by Ganas
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;

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 7:29 am
by htuser
Please can you attach the application or send it to me by private message? So, i can help you better.
Regards,

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 9:51 am
by Ganas
Dear htuser,
Attached is my application.
Regards.
Menu.zip

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 1:01 pm
by htuser
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,

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: August 31st, 2015, 5:54 pm
by Ganas
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

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: September 1st, 2015, 2:16 am
by Ganas
Dear htuser,
As per your request, please find attached application for test.
Sorry to disturb you.
Regards.

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: September 1st, 2015, 1:12 pm
by Ganas
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

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: September 1st, 2015, 2:22 pm
by htuser
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

Re: Dynamic change of data file name (Fileexist/Filerename)

Posted: September 2nd, 2015, 5:02 am
by Ganas
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.