Trillo Workbench Lessons
  • Introduction
    • Sample Application
  • Introduction to Lessons
    • IDE Lessons
    • Annotated Directory Structure
  • New classes using workbench UI
  • Save many records into tables using the workbench UI
  • New function using Workbench UI
  • Introduction to Code Lessons
    • Anatomy of Trillo Function
  • Begin Code Lessons
    • Paginated list
    • Pagination using SQL Query
    • DataIterator
    • Read file from cloud storage bucket
    • Generating signed URL for a file download
    • Import a CSV file from bucket into BigQuery
    • Query a dataset of BigQuery
    • Using an Document AI Processor
    • Chat using GenAI
    • Function calling another function
    • Accessing Runtime Context
    • Write a workflow (pipeline for data processing)
  • Appendixes
    • ServerlessFunction
    • Map, List and Tree
    • Logs and Audit Logs
    • DataRequest Class
    • DataResponse Class
    • DataIterator Class
    • Result
Powered by GitBook
On this page
  1. Begin Code Lessons

Function calling another function

This lesson describes how a function can call another function

Code: /lessons/Function_Calling_Another_Function

In this example, the function code accepts tableName, id, and records as input parameters. It gives an example of calling a function synchronously and asynchronously. The function queries records from DS synchronously and saves bulk records asynchronously.

Prerequisite

  1. In this lesson, it is assumed that functions- FunctionToCall.queryRecordsFromDSById() and FunctionToCall.saveManyRecordsInDs() already exist.

  2. It is assumed Customer class exits.

Steps

  1. Create a new function called FunctionCallingAnotherFunction.java and FunctionToCall.java.

  2. Set parameters in its function details file.

  3. Call FunctionToCall.queryRecordsFromDSById() function using FuncApi.executeFunctionWithMethod()(synchonously).

  4. It returns the response from the query.

  5. Call FunctionToCall.saveManyRecordsInDs() function using FuncApi.createTaskBySourceUid2() to save bulk records.

  6. Return the Result object (if there is failure) else return the response document.

PreviousChat using GenAINextAccessing Runtime Context

Last updated 1 year ago