Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

computed field in Form Grid

(0) ShareShare
ReportReport
Posted on by 603

Hi, I want to create some computed fields in a form grid (checkbox, price fields, discountgroup)

How can I realize this to show entered values only on the gridline I wnat (and not on all lines) and how can I get the single values to work with

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: computed field in Form Grid

    Please use the debugger to debug your code and tell us where it doesn't behave as expected.

    By the way, using allowEdit() there makes no sense. Do it in active() method of the data source.

  • CRSW Profile Picture
    CRSW 603 on at
    RE: computed field in Form Grid

    
    edit NoYes AvnOverwritePrice(boolean            _set,
    
                                VendInvoiceJour     _vendInvoiceJour,
    
                                NoYes               _overwrite)
    
    {
    
        NoYes       overwrite;
    
        ;
    
        element.findTmpFrmVirtual(tmpFrmVirtualHeader2, _vendInvoiceJour.TableId, _vendInvoiceJour.RecId);
    
     
    
        if (tmpFrmVirtualHeader2)
    
        {
    
            overwrite   = NoYes::Yes;
    
        }
    
     
    
        if (_set)
    
        {
    
            if(_overwrite == NoYes::Yes)
    
            {
    
                avnNewDiscountPercent.allowEdit(true);
    
                avnNewLineDiscountCode.allowEdit(true);
    
                element.writeTmpFrmVirtual(tmpFrmVirtualHeader2,
    
                                           _vendInvoiceJour.TableId,
    
                                           _vendInvoiceJour.RecId,
    
                                           _vendInvoiceJour.InvoiceId,
    
                                           utcDateTimeNull());
    
                overwrite   = NoYes::Yes;
    
            }
    
            else
    
            {
    
                GOENewDiscountPercent.allowEdit(false);
    
                GOENewLineDiscountCode.allowEdit(false);
    
                tmpFrmVirtualHeader2.delete();
    
                overwrite   = NoYes::No;
    
            }
    
     
    
        }
    
     
    
       return overwrite;
    
    }

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: computed field in Form Grid

    Hi CRSW,

    there must be something wrong with your code. Please check it. And if you need help, please share it. Thanks!

  • CRSW Profile Picture
    CRSW 603 on at
    RE: computed field in Form Grid

    because, as I mentioned, my values are shown an all gridlines and not only the one I entered it

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: computed field in Form Grid

    Then why do you ask how to do it if you're already aware of code doing it?

    Therefore:

    "How can I get the single values to work with?" - You get the current record in _header variable and you try to find it in the temporary table (element.findTmpFrmVirtual()).

  • CRSW Profile Picture
    CRSW 603 on at
    RE: computed field in Form Grid

    yes. Markall saves in tmpVirtualHeader and I create a myTmpVirtualHeader instance for my code

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: computed field in Form Grid

    Where do you store information about which lines have been selected? Either explain your design to us or show your code.

    MarkAll saves that in a temporary table, as you can see in editMarkAll() method.

  • CRSW Profile Picture
    CRSW 603 on at
    RE: computed field in Form Grid

    ok. more precised:

    I try to add new columns in the purchcopying form (creating a credit note)

    1 checkbox to mark if price should be overwritten

    1 field to enter new discount percentage

    1 field to select a lineDiscgroup

    The fields "discount percentage" and "lineDiscGroup" can only be filled if the checkbox is marked

    This part works for now, but after adding values to the fields and change selection of the grid line the entered data appears on each line in the grid.

    I tried to it similar to the "Mark all" field in this form

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: computed field in Form Grid

    I' don't really understand the second line of the text, but I guess Using the display Method Modifier will help you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans