So... I am dealing with a much more complicated situation in real life, but reducing it to something that is easy to demonstrate, if you add the code below to the bottom of the WebOrder sample Customer.wo (just before the End_Object of the oWebMainPanel) it doesn't do what I am trying to do.
What I am attempting here is to show, at the bottom of the view, a list of customers having the same STATE as the the customer selected in the main part of the view... and it isn't happening. I can see that in the OnConstrain in oCustomer_DD2, the state is being picked up correctly, but after that, no joy.
Code:
Procedure Refresh Integer eMode
Forward Send Refresh eMode
If not (AppSynching(ghoWebApp)) Begin
If (eMode = MODE_FIND_OR_CLEAR_SET) Begin
Send Rebuild_Constraints of oCustomer_DD2
Send Find of oCustomer_DD2 FIRST_RECORD Index.1
End
End
End_Procedure
Object oCustomer_DD2 is a cCustomerDataDictionary
Set pbUseDDSQLFilters to True
Function CustState Returns String
String sState
WebGet psValue of oCustomerState to sState
Function_Return (Trim(sState))
End_Function
Procedure OnConstrain
If (CustState(Self) <> "") ;
Constrain Customer as (Trim(Customer.State) = CustState(Self))
End_Procedure
End_Object
Send AddDDOStructure oCustomer_DD2
Object oCustomerGrid is a cWebGrid
Set Server to oCustomer_DD2
Set pbFillHeight to True
Object oNameCol is a cWebColumn
Entry_Item Customer.Name
Set psCaption to "Name"
Set piWidth to 50
Set pbPromptButton to False
End_Object
Object oStateCol is a cWebColumn
Entry_Item Customer.State
Set psCaption to "State"
Set piWidth to 40
Set pbPromptButton to False
End_Object
End_Object
The Help for AddDDOStructure is hedged around with warnings - the last line being "only use this technique if there is no better choice (considering that a better choice may be "don't do this at all")", which perhaps explains why, but help from anybody knowing better would be welcome.
Maybe Procedure Refresh isn't the right place to be triggering things, but stuff there seems to happen in the right order.
Mike