PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → physical filename including usernumber
physical filename including usernumber
Débuté par Teun van Unen, 27 mai 2005 13:17 - 4 réponses
Posté le 27 mai 2005 - 13:17
Hello,
I have a client who have more than 1 department and all want to work with the same program but with seperated files. OK, you put the files in seperated directories, but when you have onkly the file you can't see from what department.
My 'old' development tool Magic has the possibility to define filenames outside the program in an .ini file : the suffix of the filename contains a number from 00 thru 99 giving the department of the client, e.g. you can have the same file (faa01) with the following filenames faa0101 faa0102 faa0199.
Who can give me a hint how to do that in WinDev ?
TIA, Teun.
Posté le 27 mai 2005 - 14:34
Hi Teun,
I think you will have to design and hand-code a solution for that. To my knowledge there is no such function in Windev.
Personally I solved this with a kind of master data file containing, amongst others, the number of the administration I want to work in. I'm talking about a multi-company accounting and warehouse solution here. Upon logon to the application the user "connects" to one of the available administrations, pointing the program to the record in the master data file. This enables me to pre-fix all the filenames and/or database schemas (depending on the underlaying database structure I use) with a unique identifier related to the administration.
Hope this helps ?
Regards.
Filip

Hello,
I have a client who have more than 1 department and all want to work with the same program but with seperated files. OK, you put the files in seperated directories, but when you have onkly the file you can't see from what department.
My 'old' development tool Magic has the possibility to define filenames outside the program in an .ini file : the suffix of the filename contains a number from 00 thru 99 giving the department of the client, e.g. you can have the same file (faa01) with the following filenames faa0101 faa0102 faa0199.
Who can give me a hint how to do that in WinDev ?
TIA, Teun.
Posté le 28 mai 2005 - 01:17
Hello,
I have a client who have more than 1 department and all want to work with the same program but with seperated files. OK, you put the files in seperated directories, but when you have onkly the file you can't see from what department.
My 'old' development tool Magic has the possibility to define filenames outside the program in an .ini file : the suffix of the filename contains a number from 00 thru 99 giving the department of the client, e.g. you can have the same file (faa01) with the following filenames faa0101 faa0102 faa0199.
Who can give me a hint how to do that in WinDev ?
TIA, Teun.

Hallo Teun,
Have a look at the Windev functions HChangeName and/or HAlias.
My guess: "HChangename" will do the job for you in this case.
Little Example of Windev-Code:
FilenamePrefix is string = "FileFaa"
DepNo is string
You make sur you obtain (maybe via an earlier screen input)
the departement-no the user wants to work with.
You store that Dep-no in variable DepNo. (suppose you got "01")
"FileFaa" is the logical (and standard physical) filename
you defined earlier in the analysis for the file.
Together with its recordlayout, his fields and keys.
hClose(FileFaa)
HChangeName(FileFaa, FilenamePrefix + DepNo)
// If Depno was "01" input then
//as of now Windev will use the fysical file "FileFaa01"
//Important: Make sure the new physical file exists and/or is created
//with the correct analysis Record layout
HCreationIfNotFound(FileFaa)
//As of of here you can use the typical Hyperfile commands like:
HReadFirst(FileFaa), etc
HAdd(FileFaa)
HModify(FileFaa) etc
They will always work physically in "FileFaa01" (if DepNo was "01"
Kind Regards,
Lieven De Nys,
Member of the Dutch speaking Benelux Windev-Developpersgroup.
Posté le 29 mai 2005 - 19:53
Maybe you can use aliases. HAlias() I think...

Christian Potvin
Beaulieu Canada
Posté le 08 juin 2005 - 11:00
>My guess: "HChangename" will do the job for you in this case.
Hi Lieven,
It works great.
I have made the changes in the Project code section for each file e.g.:
Open(InitUser) //asking user#
// OutputFiles creation
HClose(AA00_Profile)
V_File = "FAA00_"+V_User
HChangeName(AA00_Profile,V_File)
IF NOT HCreationIfNotFound(AA00_Profile) THEN Info("Impossible to create or initialize File : AA00_Profile",HErrorInfo())
In my fileconversion project I ask for the user#, but in other projects apps I think it's better to put the user# in an INI-file.
Thanks,
Teun