Some basic question.... to debug...

Hi,

I have a problem in one of my solutions, that I cannot figure out. Therefor, some basic questions, to see if I’m approaching the issue correctly:

1 - If you have three forms based on the same table and one of these forms has an OnRecordSelection event, should that event only be triggered when a record is selected through that specific form?

2- same scenario as 1, but now in scripting: Should a search done like the code below trigger the OnRecordselection event, if the form receipt is based on the table receipt, but is NOT the form with the OnRecordSelection event?

forms.receipts.controller.find();
forms.receipts.receiptid = globals.ID1_ID;
forms.receipts.controller.search( true , false );

3 -The form I’m on is based on the table Customer, which has a relation to the ReceiptInvoice table and I’m showing the content of the related foundset of the ReceiptInvoice table in a portal. In the portal there is a button on each row (=record) triggering a method. Part of the method is the code below:

customer_to_receipt_invoice.status = ‘Reversed’
//point 1
if ( customer_to_receipt_invoice.r_i_type == ‘Receipt to Invoice’ )
{
forms.receipts.controller.find();
forms.receipts.receiptid = customer_to_receipt_invoice.id1;
forms.receipts.controller.search( true , false );
//point 2
forms.receipts.amountleft = forms.receipts.amountleft + customer_to_receipt_invoice.amount;

Now, if I output the PK ID of the ReceiptInvoice record on which I clicked the button in the portal at Point 1, I get the correct ID back, according to the logic I created. But if I request the PK ID of (to me still the same record) at point 2, I either get a completely different ID or some sort of Java message… :shock:

I would think my Find & Search on the forms.receipts should not affect the “customer_to_receipt_invoice”-relation. But judging from what happens, it does… Or am I doing something wrong???

Paul

  1. 3 forms on the same table share same foundset (unless separate foundset is specified on a form) so yes when 1 form changes the selected record the method will be triggered in other form sharing that foundset

  2. if your forms in point 1 is based on reciept,yes

  3. bit lost in your question, do you know how many rows are in the reciept form after the query at code point 2? if multiple rows are returned you likely have different sort and looking at different record…

Tnx jan, found my problem…

The first part of the code in item 3 (customer_to_receipt_invoice.status = ‘Reversed’ ) had effect on the relation. Therefor the record was out of the foundset, hence the problem.

I guess this behavior has changed after I build this funtionality. Before, the record only felt out of the foundset after savedata, now it happens directly after that piece of code that updates the record…

Anyway, got it working again…

Paul