PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Newbie Questions
Newbie Questions
Iniciado por Mark Bailey, 04,jun. 2004 17:38 - 2 respuestas
Publicado el 04,junio 2004 - 17:38
These are going to sound like a really dumb questions but
coming from a very different environment (Magic) and I am struggling
to get my head around a few concepts at the moment.
Firstly, assume I have a file defined in the LDM of a project.
The physical file is not yet created on the disk.

In the demo it explains how to create a window to Add, Edit, Delete
the records of the file using code. No problem there.

It then goes on to show you how to drop a table on the form and associate
it with the file. It uses the file that just had data added to it using data entry screen.
Hence, no code was needed to display the live data in the table.

So, the question is. Assume I had not first of all used code to enter data into the file
and instead I just wanted to enter and manipulate all data via the table form. It gives me
an error. Does this mean that if the physical file does not exist then I still need code to
create the table in the first place.

Of course what is confusing is that the RAD process does not show any code for the Window
or the Table.
The second question is..
As a trial I set up the following three files in the LDM
Companies
Company_ID
Company_Name
Address_1
Address_2
Localities
Locality_ID
Locality_Desc
Postal_Code
State_ID
States
State_ID
State_Abbrev
State_Name
and an intermediate file between Companies and Localities
Company_Locality
Locality_ID
Company_ID
Company_Locality
I then tried to set up a editable form whereby I have the Company Name, Address 1 and Address 2 in a table and the Locality in a combo box not in
the table. Also Once the Locality is selected then I want to diaplay the related postal_code and State_Abbrev
I have tried doing this using RAD but it keeps assuming a one to many style with the Locality etc in the table and the Company, Address1,Address2 in fields outside of the table.
I suspect I am going about this all wrong but have gone right through the 7.5 Tutorial and cannot glean how to do this.
Could someone please suggest the correct process for constructing this kind of arrangement.
Sorry this is so long winded.
BTW, this is all in V8 beta
Thanx in Advance.
Mark Bailey
Perth, Western Australia
Publicado el 04,junio 2004 - 23:17
Mark,
I too have left Magic and bought WinDev - what a relief to be able to write
real code again! Your questions evoke my sympathy.

Dropping a table on a window:

what is missing, I am guessing, is HCreationIfNotFound("*") in project initialisation.
If you use the wizard to create a window to contain a table to manipulate
a file, the code to create an empty file is generated.

Company/Locality:
I do not use RAD for whole file structures, this sort of thing sometimes
happens.
Use the new window wizard to create a table window for Companies file, then
drag and drop the fields from Locality outside the table. For each field,
you can use a multifile link to point from company record locality_id to
the locality file. Remember to set the locality fields to display only so
that they cannot be inadvertently amended on the company window. You may
need to add FiletoScreen() in the exit code of the locality combo box to
force the write - I can never remember, I just put it in if the fields do
not display!

Hope this points you in the right direction.
Good luck,
Andy Bewick


Mark Bailey <mbailey@arach.net.au> wrote:

These are going to sound like a really dumb questions but
coming from a very different environment (Magic) and I am struggling
to get my head around a few concepts at the moment.
Firstly, assume I have a file defined in the LDM of a project.
The physical file is not yet created on the disk.

In the demo it explains how to create a window to Add, Edit, Delete
the records of the file using code. No problem there.

It then goes on to show you how to drop a table on the form and associate
it with the file. It uses the file that just had data added to it using

data entry screen.
Hence, no code was needed to display the live data in the table.

So, the question is. Assume I had not first of all used code to enter data

into the
file
and instead I just wanted to enter and manipulate all data via the table

form. It gives
me
an error. Does this mean that if the physical file does not exist then I

still need
code to
create the table in the first place.

Of course what is confusing is that the RAD process does not show any code

for the Window
or the Table.
The second question is..
As a trial I set up the following three files in the LDM
Companies
Company_ID
Company_Name
Address_1
Address_2
Localities
Locality_ID
Locality_Desc
Postal_Code
State_ID
States
State_ID
State_Abbrev
State_Name
and an intermediate file between Companies and Localities
Company_Locality
Locality_ID
Company_ID
Company_Locality
I then tried to set up a editable form whereby I have the Company Name,

Address 1 and
Address 2 in a table and the Locality in a combo box not in
the table. Also Once the Locality is selected then I want to diaplay the

related postal_code
and State_Abbrev
I have tried doing this using RAD but it keeps assuming a one to many style

with the
>Locality etc in the table and the Company, Address1,Address2 in fields outside
of the
table.
I suspect I am going about this all wrong but have gone right through the

7.5 Tutorial
and cannot glean how to do this.
Could someone please suggest the correct process for constructing this kind

of arrangement.
Sorry this is so long winded.
BTW, this is all in V8 beta
Thanx in Advance.
Mark Bailey
Perth, Western Australia









Publicado el 05,junio 2004 - 07:09
Hi Mark

So, the question is. Assume I had not first of all used code to enter data into the file
and instead I just wanted to enter and manipulate all data via the table form. It gives me an error. Does this mean that if the physical file does not exist then I still need code to create the table in the first place.

You still don't need code to see the table (given you are accessing the file directly and not using an alias or query) but there is no physical file yet.
Use HCreationIfNotFound(FileNAme) to create the file. In the window wizard you will find a check box asking if this should be dome for you - beware this will stay valid for each time you create a window using the wizard!

Of course what is confusing is that the RAD process does not show any code for the Window >or the Table.

This in itself is an arse, as one can't see what the code is doing, but learn to live with it.
and an intermediate file between Companies and Localities
Company_Locality
Locality_ID
Company_ID
Company_Locality
I then tried to set up a editable form whereby I have the Company Name, Address 1 and Address 2 in a table and the Locality in a combo box not in
the table. Also Once the Locality is selected then I want to diaplay the related postal_code and State_Abbrev
I have tried doing this using RAD but it keeps assuming a one to many style with the Locality etc in the table and the Company, Address1,Address2 in fields outside of the table.
I suspect I am going about this all wrong but have gone right through the 7.5 Tutorial and cannot glean how to do this.
Could someone please suggest the correct process for constructing this kind of arrangement.

I could get shot by saying this, but relation (Intermediate) files can be a waste of time and definitely confuse a user.
When you make a Locality record for a company just use the company info as a lookup and fill in the record using a Vision+. You will still have about the same overhead without the extra file, just more locality records.
It's a matter of just keeping the same info once and then relating it back to another file.
Relation files can be a waste of space as they only hold two ID numbers, and in most cases are filled in to do other duties as well.
Gill