PDA

View Full Version : cWebPromptList OnSetCalculatedValue (Help!)



FrankValcarcel
11-Feb-2014, 10:23 AM
When returning from a cWebPromptList set to relational mode the proper record is found in the DD attached to the cWebFrom the prompt list was called from. The issue that OnSetCalculatedValue is not invoked for other DEOs attached to the same server when the DD record changes.

In this case I am prompting for a contact from the contact_no DEO (data bound). The name DEO (non data bound) is set to concatenate the first and last names field from the record using OnSetCalculatedValue. The OnSetCalculatedValue fires correctly when scrolling or doing a find in the contact# field but not on prompt list.

I have not been able to come up with a work around.

FrankValcarcel
11-Feb-2014, 10:35 AM
Found work around. But, I should not have to do this. When the DD is changed as the result of a promptlist the SetOnCalculatedValue should be called.



Procedure Prompt_Callback Handle hoPrompt
WebSet psPromptUpdateCallback of hoPrompt to "PromptUpdateCallback"
WebSet peUpdateMode of hoPrompt to umPromptRelational
End_Procedure
Procedure PromptUpdateCallback Handle hoModalDialog
WebSet psvalue of oActions_ContactName to (Contact.firstname * Contact.Lastname)
End_Procedure
WebPublishProcedure PromptUpdateCallback
End_Object

John van Houten
11-Feb-2014, 08:24 PM
Frank,

Can you reproduce the problem in the Web Order sample? The reason I ask is because I tried to reproduce your issue in Web Order but I found that OnSetCalculatedValue is fired correctly when the prompt list is closed.

What I did is I added a new control to the Customer.wo web view as below...



Object oCustomer_Name2 is a cWebForm
Set piColumnSpan to 6
Set piColumnIndex to 4
Set psLabel to "Name2:"
Set peLabelAlign to alignRight
Set piLabelOffset to 60

Procedure OnSetCalculatedValue String ByRef sValue
Forward Send OnSetCalculatedValue (&sValue)
Move ("***" + Customer.Name + "***") to sValue
End_Procedure
End_Object


When I click on the Customer Lookup to select a customer, the OnSetCalculatedValue is always fired correctly and the control is displaying the calculated value from the record selected in the prompt list.

regards John van Houten
Data Access Corporation

FrankValcarcel
12-Feb-2014, 08:24 AM
Thanks for testing and advising. I will readdress the issue now knowing that it is supposed to work. I will report back.
fv

FrankValcarcel
12-Feb-2014, 11:17 AM
1. I used your code in the example and It works (as expected)

2. I noticed that your are forward sending - which since the Doc calls it a hook and does not advise to do I am not doing that.

3. I took the forward send out of you example then the OnSetCalculatedValue did not update the screen, BUT!!! I cannot duplicate this as I just went in again and it works fine without the forward send (as expected). Aliens must have sucked out my brain at some point.

4. However, it still does not work in my code so I am continuing to test and will advise. Fortunately this is not a big view so I am stripping out code.

FrankValcarcel
12-Feb-2014, 12:05 PM
Ok, figured it out with your help. I did not have a SERVER set in the cWebForm where I was using the OnSetCalculatedValue. Your confirmation of operation really helped.
Thanks

Dennis Piccioni
12-Feb-2014, 12:47 PM
Hi Frank,

the help does state "If there is no data binding (no Entry_Item command) but the data entry object (DEO) is served by a DataDictionary object (DDO) Server, then the DEO is a calculated value."

FrankValcarcel
12-Feb-2014, 12:55 PM
Sure does, but it could be clearer for us simpletons - I read it but it was unclear to me. In fact the runtime should have an error message when this procedure is called "No Server defined for DEO"