PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Where to declare Structures?
Where to declare Structures?
Débuté par Abonds, 03 sep. 2015 04:36 - 5 réponses
Posté le 03 septembre 2015 - 04:36
Doing 3 tier programming. Creating structures to mimic the data files. The UI will use the structures/array of structures instead of accessing the data directly. Where do I put this structures in my program? Or do I have the wrong concept?

Thanks, Art
Posté le 03 septembre 2015 - 08:57
i use structures in WD
declare them in the init of the programm
(you can also create an external file AthlonProjectInit.wl or every other name you want and put there al the structures and variables, i do this and use this file in every WD i made, easy to refer to: EXTERN "Z:\WINDEV\Personal\Extern\AthlonProjectInit.wl" )


gs_Tabel is Structure
Factuurnr is string
Annextotaal is currency
Itusrtotaal is currency
Itusktotaal is currency
END

in the screen where you need them in the init of that screen you set up:
WorkFact is array of 10 gs_Tabel (here i need 10 pieces)
with the name Workfact i do something


in the closing section of the WD you must then stop the structure to free memory
ArrayDeleteAll (WorkFact)

Marc :cool:
Posté le 03 septembre 2015 - 14:03
Hi

I'm doing this with object progammaing.
I Have an uml scheme with description of all data files and from there I'm generating one object by data file.

yours,
Posté le 03 septembre 2015 - 20:24
Hi Marc, thanks for the excellent information.

In summary, I can create a text file with all of the data structures in it (maybe named "DataStructures.wl"), then put "EXTERN DataStructures.wl" in the initialization code of the project (or global data of the window/page), and after a compile to bring in the code I can instantiate and use the structure (either stand alone for a Form or as an array in a Browsing Table).

Do I have the correct idea here?

If so this will streamline my (and maybe others) programming immensely. I am working on a utility that reads the Analysis and creates all the data structures and writes them to a text file... a pair of data structures to be precise, one for modifying (named mDataFileName) and the other to compare with (named oDataFileName). They use the "mapping" attribute (which I have not yet fully explored, but the new MVP templates seem to be hot on them...). I am doing two structures so I can keep track of a change log and for replications purposes.
Posté le 04 septembre 2015 - 09:15
Hi Art,

You can donwload my OO FrameWork here.

In the WD version of the project you will find a window to run out of the IDE that already automatically generates all the classes with the structures and even a list of structures to represent multiple objects. The advantage is that it works with queries instead of the base data files only so you can have complete views to represent a business object.

You should be able to reuse the class generation code to create your structures if you really want to go down the structures road only.

Aside of the documentation included you can see a demo on how to use it can be found on the WXLive.us web site or on the WXLive YouTube channel.

You will see it provides a more flexible way to implement a multi-layered approach using a combination of WX products.

Cheers,

Peter Holemans
Posté le 15 septembre 2015 - 16:59
Hi Peter
I watched your video on OO development in WxDev and I am interested in your approach also but I can't seem to find a link to it. I'm new to WinDev but I developed in Clipper for many years using OOP.