Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to read Data from SubForm

(0) ShareShare
ReportReport
Posted on by 3,061

Hi

  How to read Data from Subform and then insert record in Same SourceTable or another table.

Thanks

*This post is locked for comments

  • SABIH Profile Picture
    SABIH 335 on at
    RE: How to read Data from SubForm

    Dear RockWith NAV

    I am working on dynamics 365 bc cloud ....

     i have created two table 1. cutbackBatch  table and 2. cutback process table 

    when i push on fetch event it should be read data (Bill code and License) from cutbackBatch table .If you know please help me , 

    Actually i want to retrieve field data from cutback batch table to cutback process table on respective places (bill code ,license )   ,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  

    please find below my code is not working could you please check and advise me

    action("fetch")
    {
    caption = 'Fetch';
    Promoted = true;

    PromotedCategory = Process;
    PromotedOnly = true;
    PromotedIsBig = true;
    ApplicationArea = All;
    trigger OnAction()
    var
    cutbackbatch: Record "CutBackBatchTable";
    cutbackprocess: Record "CutBackProcessTable";
    begin
    cutbackbatch.Reset();
    cutbackbatch.SETRANGE("Bill Code", "Bill Code");
    cutbackbatch.SetFilter("License", "License");
    if cutbackbatch.FINDSET then

    repeat
    cutbackprocess.INIT;

    cutbackprocess.Validate("Bill Code", "Bill Code");
    cutbackprocess.Validate("License", "License");
    cutbackprocess.Insert;

    until cutbackprocess.NEXT = 0;


    end;
    Reply

  • Suggested answer
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: How to read Data from SubForm

    Instead of showing us the code if you can explain us like what exactly you want to accomplish then that would make more sense to us.

  • SABIH Profile Picture
    SABIH 335 on at
    RE: How to read Data from SubForm

    Dear chris ,

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

    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

    5165.fetchdata.PNG

  • Suggested answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: How to read Data from SubForm

    What you are doing is just creating duplicate entries, your whole logic is wrong. You need to specify what is your actual requirement and what are you trying to accomplish? If you want to find the entries with receipt amount greater then zero then you can retrieve those using filters why are you inserting it again in the same table?

  • jsshivalik Profile Picture
    jsshivalik 3,061 on at
    RE: How to read Data from SubForm

    Hi

    i have done like this . It is working Is it correct

    CDNLine.RESET;

    CDNLine1 := CDNLine;

    CDNLine.SETRANGE("Location","No.");

    CDNLine.SETFILTER("Receipt Amount",'>%1',0);

    IF CDNLine.FINDFIRST THEN BEGIN

    REPEAT

    EntryNo := EntryNo + 1;

    CDNLine1.VALIDATE("Entry No.", EntryNo);

    CDNLine1.VALIDATE("Location", "No.");

    CDNLine1.VALIDATE("Posted Amount", CDNLine."Receipt Amount");

    CDNLine1.INSERT;

    UNTIL CDNLine.NEXT = 0;

    END;

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: How to read Data from SubForm

    You need to have a Boolean which you can set it to true once inserted into the table and while looping you will check only for false entries. Anyhow your logic of inserting the values into the same table based on a filter condition doesn’t make any sense.

    What is your actual requirement ?

  • jsshivalik Profile Picture
    jsshivalik 3,061 on at
    RE: How to read Data from SubForm

    Hi Suresh

    I have change the code but it goes in infinite loop

    CDNLine.RESET;
    CDNLine.SETRANGE("Location","No.");
    IF CDNLine.FINDLAST THEN
    EntryNo := CDNLine."Entry No.";

    CDNLine.RESET;
    CDNLine.SETRANGE("Location","No.");
    CDNLine.SETFILTER("Receipt Amount",'>%1',0);
    IF CDNLine.FINDFIRST THEN BEGIN
    REPEAT

    EntryNo := EntryNo + 1;

    CDNLine1 := CDNLine;
    CDNLine1.VALIDATE("Entry No.", EntryNo);
    CDNLine1.VALIDATE("Location", "No.");
    CDNLine1.VALIDATE("Posted Amount", CDNLine."Receipt Amount");
    CDNLine1.INSERT;
    CDNLine.VALIDATE("Receipt Amount", 0);
    CDNLine.MODIFY;
    UNTIL CDNLine.NEXT = 0;
    END;

    Thanks

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: How to read Data from SubForm

    I am not asking to use two tables, create two different variables of the same table.  One for looping and another for inserting. You cannot use the same variable to create and find. It will remove the filters you have applied.

  • jsshivalik Profile Picture
    jsshivalik 3,061 on at
    RE: How to read Data from SubForm

    Hi

     ok.  In my scenario i am using only 1 table. That's why i have to do like this . If i was using 2 tables then it should not have been any issue

    Thanks

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans