PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Trouble with File..NewRecord value...
Trouble with File..NewRecord value...
Iniciado por Kevin Erskine, 05,may. 2009 10:40 - 4 respuestas
Publicado el 05,mayo 2009 - 10:40
WebDev v12

I have a page with a table on it and in the "Modify" button code I have

// Is a record selected
IF TableSelect(TABLE_ProductPhoto)=-1 THEN RETURN

// open the form of FileB file in modification mode
PageDisplay(PAGE_Form_ProductPhoto)

On the Form I am displaying ProductPhoto..NewRecord and it is always True

The online help does not show "TableSelect" as setting the NewRecord to
False like other commands (fReadSeekFirst etc...)

Any ideas? Is this a known problem?

Thanks.

--
Kevin Erskine
Software By Ragazzi
www.Software-By-Ragazzi.com
Alameda, CA (USA)
Publicado el 05,mayo 2009 - 13:25
Hi Kevin...

tableselectplus does NOT set ..newrecord and it's a good thing, because
if you rely on that, imagine what would happen in the following case:

- you DO have a line selected (..newrecord WOULD be false)
- you click on your NEW button anyway to CREATE a new record
- in the form you test on ..Newrecord and you end up in EDIT mode????

The correct way to do this kind of things is to send the form a
parameter for the opening mode ("NEW" or "EDIT" in our case) and test on
it...

Depending on your needs, you can also pass as a second parameter the ID
of the record to edit, allowing the form to be opened easily on ANY
record (not always the current one) from other places than the table
displaying the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
WebDev v12

I have a page with a table on it and in the "Modify" button code I have

// Is a record selected
IF TableSelect(TABLE_ProductPhoto)=-1 THEN RETURN

// open the form of FileB file in modification mode
PageDisplay(PAGE_Form_ProductPhoto)

On the Form I am displaying ProductPhoto..NewRecord and it is always True

The online help does not show "TableSelect" as setting the NewRecord to
False like other commands (fReadSeekFirst etc...)

Any ideas? Is this a known problem?

Thanks.
Publicado el 06,mayo 2009 - 10:32
You say the "Correct way"

Well I was showing you the code produced by "RAD" -- so are you saying they
are doing it wrong?

And the documentation says use .NewRecord to know if you are in insert or
modify mode and they rely on the flag in the "Validate" button...

So as a person new to WebDev it is confusing to try and follow the RAD code
as a guide and then have it not work, and then have you say their (PCSoft)
way is all wrong...

I will begin changing ALL my code -- Ughhhh

Thanks for the heads up
Kevin

"Fabrice Harari" <fromweb@fabriceharari.com> wrote in message
news:4a0001f4$1@news.pcsoft.fr...

Hi Kevin...

tableselectplus does NOT set ..newrecord and it's a good thing, because
if you rely on that, imagine what would happen in the following case:

- you DO have a line selected (..newrecord WOULD be false)
- you click on your NEW button anyway to CREATE a new record
- in the form you test on ..Newrecord and you end up in EDIT mode????

The correct way to do this kind of things is to send the form a
parameter for the opening mode ("NEW" or "EDIT" in our case) and test on
it...

Depending on your needs, you can also pass as a second parameter the ID
of the record to edit, allowing the form to be opened easily on ANY
record (not always the current one) from other places than the table
displaying the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
WebDev v12

I have a page with a table on it and in the "Modify" button code I have

// Is a record selected
IF TableSelect(TABLE_ProductPhoto)=-1 THEN RETURN

// open the form of FileB file in modification mode
PageDisplay(PAGE_Form_ProductPhoto)

On the Form I am displaying ProductPhoto..NewRecord and it is always True

The online help does not show "TableSelect" as setting the NewRecord to
False like other commands (fReadSeekFirst etc...)

Any ideas? Is this a known problem?

Thanks.


--
Kevin Erskine
Software By Ragazzi
www.Software-By-Ragazzi.com
Alameda, CA (USA)
Publicado el 06,mayo 2009 - 12:55
Hi Kevin...

I'm sorry about the RAD, but as I'm not using it, I have no idea what
they are doing in it...

Now as I was describing the potential problem in using ..newRecord, I
was pointing out a logical flaw in that system... And if the RAD is
doing it that way, then yes, there is a problem...

At a time, passing a parameter to the form WAS the RAD way, so obvioulsy
things change, not always for the best

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
You say the "Correct way"

Well I was showing you the code produced by "RAD" -- so are you saying they
are doing it wrong?

And the documentation says use .NewRecord to know if you are in insert or
modify mode and they rely on the flag in the "Validate" button...

So as a person new to WebDev it is confusing to try and follow the RAD code
as a guide and then have it not work, and then have you say their (PCSoft)
way is all wrong...

I will begin changing ALL my code -- Ughhhh

Thanks for the heads up
Kevin

"Fabrice Harari" <fromweb@fabriceharari.com> wrote in message
news:4a0001f4$1@news.pcsoft.fr...
Hi Kevin...

tableselectplus does NOT set ..newrecord and it's a good thing, because
if you rely on that, imagine what would happen in the following case:

- you DO have a line selected (..newrecord WOULD be false)
- you click on your NEW button anyway to CREATE a new record
- in the form you test on ..Newrecord and you end up in EDIT mode????

The correct way to do this kind of things is to send the form a
parameter for the opening mode ("NEW" or "EDIT" in our case) and test on
it...

Depending on your needs, you can also pass as a second parameter the ID
of the record to edit, allowing the form to be opened easily on ANY
record (not always the current one) from other places than the table
displaying the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
WebDev v12

I have a page with a table on it and in the "Modify" button code I have

// Is a record selected
IF TableSelect(TABLE_ProductPhoto)=-1 THEN RETURN

// open the form of FileB file in modification mode
PageDisplay(PAGE_Form_ProductPhoto)

On the Form I am displaying ProductPhoto..NewRecord and it is always True

The online help does not show "TableSelect" as setting the NewRecord to
False like other commands (fReadSeekFirst etc...)

Any ideas? Is this a known problem?

Thanks.

Publicado el 07,mayo 2009 - 09:46
I appreciate your expert thoughts -- as I said I am still learning -- glad
to learn this technique early on and not later

Thanks again.

"Fabrice Harari" <fromweb@fabriceharari.com> wrote in message
news:4a014ce9@news.pcsoft.fr...

Hi Kevin...

I'm sorry about the RAD, but as I'm not using it, I have no idea what
they are doing in it...

Now as I was describing the potential problem in using ..newRecord, I
was pointing out a logical flaw in that system... And if the RAD is
doing it that way, then yes, there is a problem...

At a time, passing a parameter to the form WAS the RAD way, so obvioulsy
things change, not always for the best

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
You say the "Correct way"

Well I was showing you the code produced by "RAD" -- so are you saying
they
are doing it wrong?

And the documentation says use .NewRecord to know if you are in insert or
modify mode and they rely on the flag in the "Validate" button...

So as a person new to WebDev it is confusing to try and follow the RAD
code
as a guide and then have it not work, and then have you say their
(PCSoft)
way is all wrong...

I will begin changing ALL my code -- Ughhhh

Thanks for the heads up
Kevin

"Fabrice Harari" <fromweb@fabriceharari.com> wrote in message
news:4a0001f4$1@news.pcsoft.fr...
Hi Kevin...

tableselectplus does NOT set ..newrecord and it's a good thing, because
if you rely on that, imagine what would happen in the following case:

- you DO have a line selected (..newrecord WOULD be false)
- you click on your NEW button anyway to CREATE a new record
- in the form you test on ..Newrecord and you end up in EDIT mode????

The correct way to do this kind of things is to send the form a
parameter for the opening mode ("NEW" or "EDIT" in our case) and test on
it...

Depending on your needs, you can also pass as a second parameter the ID
of the record to edit, allowing the form to be opened easily on ANY
record (not always the current one) from other places than the table
displaying the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Kevin Erskine wrote:
WebDev v12

I have a page with a table on it and in the "Modify" button code I have

// Is a record selected
IF TableSelect(TABLE_ProductPhoto)=-1 THEN RETURN

// open the form of FileB file in modification mode
PageDisplay(PAGE_Form_ProductPhoto)

On the Form I am displaying ProductPhoto..NewRecord and it is always
True

The online help does not show "TableSelect" as setting the NewRecord to
False like other commands (fReadSeekFirst etc...)

Any ideas? Is this a known problem?

Thanks.



--
Kevin Erskine
Software By Ragazzi
www.Software-By-Ragazzi.com
Alameda, CA (USA)