In Notes I have a form (Order) in which I have button "Create new OrderLine" which creates a new form(Orderline). The Order document has an embedded view on the design which gets orderlines documents. Each orderline document contains a hidden field with the ID of the order document, so that you know which orderline is connected with which order. Same goes for Orderline this has an embeddedview with Prices.
In the Order form I have 2 editable text fields: AdministrationNumber and DebtorNumber.
In the OrderlineForm I only got the debtorNumber
In Prices I have a editable number field called Fee.
So I did this on various ways:
In the postOpen of the form prices I have put this LotusScript code:
If( (Source.FieldGetText( "AdministrationNumber" ) = "1" ) And (Source.FieldGetText( "DebtorNumber" ) = "2") ) Then
Call Source.FieldSetText("FeePercentage", "4.235")
Call Source.Refresh()
End If
But did not work.
In Default Value of Fee I also tried this formula code:
@If((AdministrationNumber="1") & (DebtorNumber= "2");
"4,235";
"0"
)
But also of no use..
Is it possible for an editable field to be set when opening the subform based on conditional statement with data which is in the parent form?
Edit
2 ways to solve:
1.
When clicking "Add new Orderline" Button whic is on the Order form, I will call a function in the scriptlibrary, in this function I get values of debnr and admnr and then do the conditional statement.. If true then set FeePercentage
2.
Added new hidden field on the orderlline called admnr which gets the administratorNr field data when the New Orderline Button is clicked.. The field is set through a function in the scriptlibrary.
Eventually in the postOpen of the prices subform this works:
Dim doc As NotesDocument
Set doc = Source.Document
If doc.admnra(0) = "1" And doc.debnr(0) = "2" Then
doc.FeePercentage = 4.235
End If