1

I am using edit method on a form Check box control in a Grid and data source is a view. The parameter in _set boolean is not setting to true when we clicked on the check box. The code in the edit method is as follows.

 edit NoYes markNow(
        boolean                 _set,
        VendInvoiceProdReceiptNotInvoicedView      _vendInvoiceProdReceiptNotInvoicedViewLocal,
        NoYes                   _markNow)
    {
        if (_set)
        {
            if (_markNow)
            {
                matchedReceipts.insert(_vendInvoiceProdReceiptNotInvoicedViewLocal.VendPackingSlipJourRecId, _vendInvoiceProdReceiptNotInvoicedViewLocal.PackingSlipId);
            }
            else
            {
                if (matchedReceipts.exists(_vendInvoiceProdReceiptNotInvoicedViewLocal.VendPackingSlipJourRecId))
                {
                    matchedReceipts.remove(_vendInvoiceProdReceiptNotInvoicedViewLocal.VendPackingSlipJourRecId);
                }
            }
            this.refresh();
        }

        return matchedReceipts.exists(_vendInvoiceProdReceiptNotInvoicedViewLocal.VendPackingSlipJourRecId) ? NoYes::Yes : NoYes::No;
    }

Could you please help me with this.

venkat pasumarti
  • 138
  • 1
  • 1
  • 12
  • 2
    `this.refresh();` looks suspicious to me. If you debug and you're not seeing `_set == true`, then it sounds like the code isn't the issue, but perhaps the checkbox property. Are you sure the datasource/method are set on the control? Try to isolate the issue by creating a new form, grid, and adding the view datasource and seeing if you can reproduce it. – Alex Kwitny Nov 22 '21 at 15:50
  • 1
    @AlexKwitny Thanks for the suggestion, I have set the datasource/datamethod properties on the control. As per your suggestion I have researched little bit on the control properties and the datasources. Turns out when we use the View as a datasource we can't edit it. That is why `_set==true` is not happening. When I use a regular table as a datasource then edit method is working fine. – venkat pasumarti Nov 23 '21 at 05:16
  • Oh of course. `Views` are for viewing only. I thought you had an edit method or some other field. That's easy enough. If you want to use the view, you can add a helper method or be creative. – Alex Kwitny Nov 23 '21 at 17:07

1 Answers1

1

Edit methods cannot be used on top of Views as data source, Use regular table as data source.

venkat pasumarti
  • 138
  • 1
  • 1
  • 12