Need to edit data in 2 tables using editable grid

Certified Associate Developer

Hi all, 


I am working on editable grid where I am adding invoice items for students training. I have two tables which are Invoice_Details and Student_Training_Details. When I am adding the Invoice_Details in the editable grid, I also need to enter the Training_Completed_Date for each student which is a field in Student_Training_Details. How can I achieve this? I have the foreign key FK_STUDENT_ID in both the tables. Thank you.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    hi,

    you can create a some variables:

    ri!studentsTrainingDetails

    - here you can load alldetails which are relevant for your invoicing. you can do this in your form or in process script task in advance 

    you can load them by creating a queryEntity with a entityFilter and search for your FK_STUDENT_ID


    Then if you have your editibale grid, you update your student_Trianing_details by an a!save().

    But the exact approach depends stongly on your CDT and form structue. 

    possible solution
    :  

    a!datefield(
        label: "Training completed at",
        value: ri!Invoice_Detail.Training_Completed_Date,
        saveInto:{
            a!save(
                target:ri!Invoice_Detail.Training_Completed_Date,
                value:save!value
            ),
            a!save(
                target:ri!Student_Training_Details.Training_Completed_Date,
                value:ri!Invoice_Detail
            )
    
        }
    )

Reply
  • 0
    Certified Senior Developer

    hi,

    you can create a some variables:

    ri!studentsTrainingDetails

    - here you can load alldetails which are relevant for your invoicing. you can do this in your form or in process script task in advance 

    you can load them by creating a queryEntity with a entityFilter and search for your FK_STUDENT_ID


    Then if you have your editibale grid, you update your student_Trianing_details by an a!save().

    But the exact approach depends stongly on your CDT and form structue. 

    possible solution
    :  

    a!datefield(
        label: "Training completed at",
        value: ri!Invoice_Detail.Training_Completed_Date,
        saveInto:{
            a!save(
                target:ri!Invoice_Detail.Training_Completed_Date,
                value:save!value
            ),
            a!save(
                target:ri!Student_Training_Details.Training_Completed_Date,
                value:ri!Invoice_Detail
            )
    
        }
    )

Children
No Data