Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Want to get tick on my check box if my field is true

(0) ShareShare
ReportReport
Posted on by 75

Here I have a alertine table where if warning field is yes then I

Want  my  checkbox (which is in alert header table)ticked in Al code how can we do that?

  • Shankar Profile Picture
    Shankar 75 on at
    RE: Want to get tick on my check box if my field is true

    Hi, Tabrez, here I have created assembly orders, and I have extended warning field in assembly line so when I add item the field is yes, then the field avail warning which I extended in assembly header should be ticked,

    This is my code what wrong in this,

    codeunit 50103 ExtAssembly

    {

        procedure MyProcedure()

        var

            AssemblyLines: Record "Assembly Line";

            AssemblyHeader: Record "Assembly Header";

            availableWarning: Boolean;

            Enum_DocumentType: Enum "Assembly Document Type";

        begin

            AssemblyHeader.SetRange("No.", AssemblyLines."Document No.");

            AssemblyHeader.SetRange("Document Type", Enum_DocumentType::Order);

            // availableWarning := AssemblyLines.FindFirst();

            if AssemblyHeader.FindSet() then

                repeat

                    AssemblyLines.SetRange("Avail. Warning", true);

                    if AssemblyLines."Avail. Warning" = true then begin

                        AssemblyHeader."Avail. Warning" := true;

                        AssemblyHeader.Modify();

                    end;

                until AssemblyLines.Next() = 0;

        end;

    }

    Can you please updates in this , as I am not getting my (assembly header) checkbox checked if the field is yes in assembly line. So,

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 993 Super User 2024 Season 1 on at
    RE: Want to get tick on my check box if my field is true

    You will have to do something like this:

    Alertline.setrange("Document.No',Alertheader."No.")

    If Alertline.findset(Treu,false) then repeat

    If Alertline.warning = true then

    Begin

    Alertheader.setrange(No, Alertine.No)

    Alertheader.ticked := yes;

    Alertheader.modify()

    End

    until Alertline.next() =0;

  • TabrezAjaz Profile Picture
    TabrezAjaz 190 on at
    RE: Want to get tick on my check box if my field is true

    Hi Shankar,

    Can you give more information about, Item having a field alert?

    When using SetRange the any type of find is required if not using any find methods, then make sure to have check for Record.IsEmpty.

    After you got the desired filtered record then you can modify your records, if there are more than one records in filter then you can use repeat....until to traverse each filtered record.

    Provide more information about your tables and the fields on which you are trying to do something.

  • Suggested answer
    Dallefeld Profile Picture
    Dallefeld 169 User Group Leader on at
    RE: Want to get tick on my check box if my field is true

    Looking at your code, you do a setrange, but don't you need a find after that to get the appropriate record to modify?

  • Shankar Profile Picture
    Shankar 75 on at
    RE: Want to get tick on my check box if my field is true

    Here is my code:

    Alertline.setrange("Document.No',Alertheader."No.")

    If Alertline.warning = true then

    Begin

    Alertheader.setrange(No, Alertine.No)

    Alertheader.ticked := yes;

    Alertheader.modify()

    End

    When item has alert field yes then my alertheader checkbox is not ticked What can be done.? Here

  • Suggested answer
    RE: Want to get tick on my check box if my field is true

    Hi,

    You can define the flowfield in the header table and use calcformula property to find if the line field is true.

    Regards,

    YSR

  • Verified answer
    TabrezAjaz Profile Picture
    TabrezAjaz 190 on at
    RE: Want to get tick on my check box if my field is true

    Hi Sankar, 

    Based on the question asked here is my sample AL code suggestion for you: 

    sample-code.PNG

    Don't forget to LIKE & VERIFY, if it helps anyway.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans