I am facing issue when selecting rows from a webLookup to select main record that has a null parent.
Tested on 19.0 and 19.1 A4 and same happens.
2 regular tables. Main and parent, but the parent can be null (ParentNullAllowed set to true for this parent)
But additionally to this, Not all parents are allowed to be part of the relation, just a sub-set of them. hence on My parent DDO (or class, whatever), I have constraint set defined, so the users can only select the required sub-set of rows.
so, the DDO structue is like this:
Code:
Object oServidor_DD is a cServidorDataDictionary
Procedure OnConstrain
Forward Send OnConstrain
Constrain Servidor.iServidor eq 1
End_Procedure
End_Object
Object oCadastro_DD is a cCadastroDataDictionary
Set DDO_Server to oServidor_DD
End_Object
Set Main_DD To oCadastro_DD
Set Server To oCadastro_DD
Remember that inside cCadastroDataDictionary I have set the NullParentAllowed
cCadastroDataDictionary.dd:
Code:
...
Procedure Construct_Object
Forward Send Construct_Object
Set Main_File to Cadastro.File_Number
Set Add_Server_File to Servidor.File_Number
Set ParentNullAllowed Servidor.File_Number to True
...
Now, withing the webview, I can create a rercord for the main table without a parent (null-parent) successfully.
But, I can´t find this same row anymore. either by using the toolbars Find buttons, or by filling the row identifier in the webform and trying to find it using F9.
In this case, no error are shown. but the record is just not showed in the view (ddo buffer not populated)
And If you try to select this same row, from a webLookup, (The row is shown inside weblookup, because there I have not set the constraint in the parent DDO) after selecting the row, I receive the error 4527 when the Lookup tries to perform the relational update to the invoking view.
I tracked it down, and the issue is under FindByRowIdEx, which I cant debugg any further as its hidden in the runtime.
cWebPromptList:
Code:
Procedure OnMoveValueOutByRelational Handle hoInvokingObject
RowID rRowId
Handle hoInvokingServer hoServer
Integer iFile
Boolean bDataAware bSuccess
Get pbDataAware to bDataAware
If not bDataAware Begin
// this should have already been tested and should not be possible
Error DFERR_PROGRAM "Assert: OnMoveValueOutByRelational called by non data aware grid list can not be used as a relational prompt list for this object"
Procedure_Return
End
Get Server to hoServer
Get Main_File of hoServer to iFile
Get CurrentRowId of hoServer to rRowId
If (not(IsNullRowID(rRowId))) Begin
Get Server of hoInvokingObject to hoInvokingServer
Get FindByRowIdEx of hoInvokingServer iFile rRowId to bSuccess // <<--- here
// this is very unlikely
If not bSuccess Begin
Error DFERR_CANT_REFIND_RECORD
End
End
End_Procedure
This happens for "orphan" rows (rows that has a null parent). It seems that the parent constraint are being enforced for such cases. what does not makes sense at all!
<edit>: Actually, I just tested this for a row that has a relation to a valid parent (parent that satisfy the constraint rule) and the same happens. <end-edit>
<edit2>: you can ignore the 1st edit, it was a bad relationship here in my data. once that was fixed the finds works ok for rows with valid relationships (not-null) ! <end-edit2>
If I just remove the Constraint, the ALL rows are found properly.
Please advise. I'm stuck right now as I can´t simply remove the constraint rule.
Regards