DCSAY... GET .... VALID ... question

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

DCSAY... GET .... VALID ... question

#1 Post by skiman »

Hi,

I have a lot of GET's with a valid. This is working without any problem. I'm looking to my sources to optimize the speed of my application. I see that the VALID codeblock is always executed, even when there is nothing changed in the GET. This is normal behaviour and is fine in most cases.

However, in some cases the VALID is doing a lot of unnecessary things if the GET isn't changed.

I take ... GET cCustomer VALID {|oGet| seekcustomer(..) } as an example.
The VALID block with seekcustomer is opening a table, searching the value, ... which takes some time. If cCustomer isn't changed, there is no need to do all this.

What would be the best way to avoid this?
Changing the codeblock as follows seems to work, but I'm wondering if there is a better way?
VALID {|oGet| iif(!empty(oGet:buffer) .and.oGet:buffer==oGet:undobuffer,.T.,seekcustomer(...)) }

The change in speed is minor, but when there are 40 users working, the change can make a difference.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCSAY... GET .... VALID ... question

#2 Post by rdonnay »

Let me look into this.

There is probably something I can do in eXpress++.

Here's an update.

DC_GetValidate() has been reworked a lot over the years.
There is even a get-set function call DC_GetValidateOnChange() however this affects all validations.

I think that your workaround is the best solution, because a global solution may give undesired results.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCSAY... GET .... VALID ... question

#3 Post by skiman »

Hi Roger,

In some cases the VALID codeblock MUST always be executed, even if there is nothing changed!
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCSAY... GET .... VALID ... question

#4 Post by rdonnay »

DC_GetValidate() has been reworked a lot over the years.
There is even a get-set function call DC_GetValidateOnChange() however this affects all validations.

I think that your workaround is the best solution, because a global solution may give undesired results.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCSAY... GET .... VALID ... question

#5 Post by skiman »

Roger,

There is XbpSLE:changed, but it looks as the DCGET isn't a subclass of XbpSle?

XbpSLE also has :cuebanner. Is there any way to do this with eXpress++?
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCSAY... GET .... VALID ... question

#6 Post by skiman »

Hi Roger,

By checking your code for the implementation of your DC_GetValidateOnChange(), I found the answer.
VALID {|oGet| iif(oGet:get:changed,seekcustomer(...),.T.) }

This looks as an easy way to decide wether or not the valid must be executed.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCSAY... GET .... VALID ... question

#7 Post by skiman »

Hi,

According to my code the DC_GetValidateOnChange() is checking the value oGet:get:changed to decide if the value in a GET is changed.

If there is a POPUP for the GET which changes the GET value, the var oGet:get:changed remains FALSE.

So it won't validate with the new value!
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCSAY... GET .... VALID ... question

#8 Post by rdonnay »

Sorry, I got so busy the past few days that I haven't been following this thread.

What is it that you want me to do?

Can you write me a small snippet of code that demonstrates your problem?
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCSAY... GET .... VALID ... question

#9 Post by skiman »

Hi Roger,

I don't expect that you change anything for this. My original question was how to avoid the execution of a VALID when there is nothing changed. I thought there would be an easy way to accomplish this.

Meanwhile I have a solution for this, in combination with the POPUP which is also executing the VALID..

When the popup is used, the VALID is executed only once. If nothing is changed, the VALID isn't executed. I'm using :cargo to get the result I want. With GETEVAL I set the :cargo at start.

This way the VALID is only executed ONCE after a change of the GET. I expect this will reduce the network traffic when there are a lot of users.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCSAY... GET .... VALID ... question

#10 Post by rdonnay »

Ok, thanks. I'm glad you found a solution.
The eXpress train is coming - and it has more cars.

Post Reply