Welcome! Log In Create A New Profile

Advanced

Trouble with File..NewRecord value...

Posted by "Kevin Erskine".pcs.crosspost 
"Kevin Erskine".pcs.crosspost
Trouble with File..NewRecord value...
May 05, 2009 08:40AM
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)

Message forwarded from pcsoft.us.windev
Regards !
I do not using WebDev but I think it is same situation.
Simple, why, if there is no other solution do this:

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

nMyRecord is int = HrecNum(ProductPhoto)

//This will (I hope) switch ..NewRecord to FALSE
Hread(ProductPhoto, nMyRecord)

PageDisplay(PAGE_Form_ProductPhoto)

HRead like many xRead functions switch ..NewRecord to FALSE.
Fabrice Harari.pcs.crosspost
Re: Trouble with File..NewRecord value...
May 05, 2009 11:25AM
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 [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.
>
Message forwarded from pcsoft.us.windev
"Kevin Erskine".pcs.crosspost
Re: Trouble with File..NewRecord value...
May 06, 2009 08:32AM
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 [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)

Message forwarded from pcsoft.us.windev
Jimbo
Re: Re: Trouble with File..NewRecord value...
May 06, 2009 08:51AM
Hi, just for the record: RAD 'Form with Browse' identifies whether it is in Insert or Modify-Mode by the two variables: OpeningMode and WindowMode. They are set either to "Creation" or to "Modif". WindowMode can be changed (in procedure ModifyWi9ndowMode) because you could switch the Form from Browse-Mode either to "Modif"-ication-Mode or to "Creation"-Mode and from there back to Browse-Mode. So, NewRecord is not required at all. The buttons [ Modify] and [ New ] of a 'Table with Browse'-Window will switch the Form into the correct mode (= OpeningMode) anyway. So, what's the exact problem here?

Regards, Guenter

[quote "Kevin Erskine".pcs.crosspost]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 [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)

Message forwarded from pcsoft.us.windev[/quote]
Ruben Sanchez Peña
Re: Re: Trouble with File..NewRecord value...
May 06, 2009 10:47AM
Hi Jimbo. The new RAD (introduced in WX12) use the ..NewRecord property, not use the OpeningMode and WindowMode variables.
Fabrice Harari.pcs.crosspost
Re: Trouble with File..NewRecord value...
May 06, 2009 10:54AM
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 [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 [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.
>>>
>
Message forwarded from pcsoft.us.windev
Jimbo
Re: Re: Trouble with File..NewRecord value...
May 06, 2009 11:32AM
Oh, I see! I'm sorry! Didn't believe that anybody would use those .. always good for a surprise. I'm using RAD 11 with a few modifications as MDI generator. Plus, I'm in the works to build a new RAD scheme based on good old RAD 11 too. Kind regards, Guenter
"Kevin Erskine".pcs.crosspost
Re: Re: Trouble with File..NewRecord value...
May 07, 2009 07:45AM
Well based on Fabrice's response I am not sure which method to use --
passing parameter sounds safer but .NewRecord seems to be the "new correct"
way.

"Ruben Sanchez Peña" <guest@news.pcsoft.fr> wrote in message
news:69462009050610500336.26909@news.pcsoft.fr...
>
> Hi Jimbo. The new RAD (introduced in WX12) use the ..NewRecord property,
> not use the OpeningMode and WindowMode variables.
>

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

Message forwarded from pcsoft.us.windev
"Kevin Erskine".pcs.crosspost
Re: Trouble with File..NewRecord value...
May 07, 2009 07:46AM
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 [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 [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)

Message forwarded from pcsoft.us.windev
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: