web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

how to read data from one page to another page using extension language (AL) in d365bc cloud ?

(0) ShareShare
ReportReport
Posted on by 339

Dear experts ,

how to read data from one page to another page using extension language (AL) in d365bc cloud ?when i click on fetch event it should be read data from cutbackBatch table .If any one know please advise me or please help me ,Please see below screenshot

0458.fetchdata.PNG

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    You need to write code under your action in order to retrieve the code on the other table.

  • SABIH Profile Picture
    339 on at

    Dear  Stefano Demiliani ,

    Could you please share me vs code here for retrieve the code on the other table for this please help me

    Please see below my action cod

    action("fetch")

                   {

                       caption = 'Fetch';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       ApplicationArea = All;

                       trigger OnAction()

                       begin

                       end;

                   }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    I dont know your tables and what you want to do in your application. If you mean retrieving records in the UI, this is automatically done if you've correctly set the tablerelation property between your tables (header and lines).

    If instead you need to press a button and from that action retrieving records via code, you need to apply filters.

    In the OnAction trigger, write the code for retrieving the records from your cutbackBatch table.

    Something like:

    cutbackBatch.SETRANGE(YourField, "Bill Code");

    //other filters here

    if cutbackBatch.FINDSET then

    repeat

     //here you're looping through your retrieved records

    until cutbackBatch.NEXT=0;

  • SABIH Profile Picture
    339 on at

    Dear Stefano Demiliani ,

    i have two table cutbackbatch table and cutback process table please find below screenshot

    cutbackbatch table

    cutback-process.PNG

    cutback process table

    cutback-process.PNG

    her i am using the code please see below but cant retrieve data from cutback batch table ,can you provide again vs code then i will understand what is the flow

    right now i am confusing

    page 50106 CutBackProcessWorksheetPage

    {

       PageType = Worksheet;

       ApplicationArea = All;

       UsageCategory = Administration;

       SourceTable = CutBackProcessTable;

       Caption = 'Cutback Process';

       layout

       {

           area(Content)

           {

               field("Batch Name"; "Batch Name")

               {

                   ApplicationArea = All;

               }

               field("PostingDate"; "Posting Date")

               {

                   ApplicationArea = All;

               }

               repeater(CutbackProcess)

               {

                   field("Posting Date"; "Posting Date")

                   {

                       ApplicationArea = All;

                   }

                   field("Account Category"; "Account Category")

                   {

                       ApplicationArea = All;

                   }

                   field("Bill Code"; "Bill Code")

                   {

                       ApplicationArea = All;

                   }

                   field("Partner"; "Partner")

                   {

                       ApplicationArea = All;

                   }

                   field("License"; "License")

                   {

                       ApplicationArea = All;

                   }

                   field("Percentage"; "Percentage")

                   {

                       ApplicationArea = All;

                   }

                   field("Account"; "Account")

                   {

                       ApplicationArea = All;

                   }

                   field("Account Description"; "Account Description")

                   {

                       ApplicationArea = All;

                   }

                   field("AFE"; "AFE")

                   {

                       ApplicationArea = All;

                   }

                   field("Amount"; "Amount")

                   {

                       ApplicationArea = All;

                   }

                   field("Posted"; "Posted")

                   {

                       ApplicationArea = All;

                   }

               }

           }

       }

       actions

       {

           area(Processing)

           {

               group(Setup)

               {

                   action("Calculate")

                   {

                       Caption = 'Calculate';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       // RunObject = page "CutBackBatchPage";

                       ApplicationArea = All;

                       trigger OnAction()

                       begin

                           // Message('Please select the batch name ');

                       end;

                   }

                   action("Post")

                   {

                       Caption = 'Post';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       ApplicationArea = All;

                       trigger OnAction()

                       begin

                       end;

                   }

                   action("Print")

                   {

                       Caption = 'Print';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       ApplicationArea = All;

                       trigger OnAction()

                       begin

                       end;

                   }

                   action("Post and Print")

                   {

                       Caption = 'Post and Print';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       ApplicationArea = All;

                       trigger OnAction()

                       begin

                       end;

                   }

                   action("fetch")------------------------------------------------here am using action for retrieve data from cutbackbatch table

                   {

                       caption = 'Fetch';

                       Promoted = true;

                       PromotedCategory = Process;

                       PromotedOnly = true;

                       PromotedIsBig = true;

                       ApplicationArea = All;

                       trigger OnAction()

                       var

                           cutbackbatch: Record "CutBackBatchTable";

                       begin

                           cutbackbatch.Reset();

                           cutbackbatch.SETRANGE("Bill Code", "Bill Code");

                           if cutbackBatch.FINDSET then

                               repeat

                                   cutbackbatch.INIT;

                                   cutbackbatch.VALIDATE("License", "License");

                                   cutbackbatch.INSERT;

                               until cutbackBatch.NEXT = 0;

                       end;

                   }

               }

           }

       }

    }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    This code has no sense:

    cutbackbatch.Reset();

                          cutbackbatch.SETRANGE("Bill Code", "Bill Code");

                          if cutbackBatch.FINDSET then

                              repeat

                                  cutbackbatch.INIT;

                                  cutbackbatch.VALIDATE("License", "License");

                                  cutbackbatch.INSERT;

                              until cutbackBatch.NEXT = 0;

    Here you're filtering the cutbackbatch table (correct!) and for every retrieved records you call an INSERT. This code fails every time with an error.

    What must do your action? Your code is right except what you're doing in the repeat ... until block. But I cannot imagine qhat you want to do after you've retrieved the records.

  • SABIH Profile Picture
    339 on at

    Dear stefano

    actually i want to retrieve field data from cutback batch table to cutback process table on respective places (bill code ,license ) if you have any doubt you can check above screenshot   ,two field data i want to retrieve (bill code and license ) from cutback batch table ,actually i dont how to do extension code for this ,if you dont mind could you please provide full code then i will add in to action  

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans