El objeto context proporciona una interfaz poderosa para acceder a datos y ejecutar acciones dentro del Report Static Query Builder.
Está disponible globalmente como:
window.context
Contiene varios componentes clave que permiten interactuar con parámetros, tablas, flujos, formularios y consultas.
Estructura General
{params:{},// Query parameterstable:{},// Available tables with dataflow:Function,// Load or open a flowform:Function,// Open a formquery:{}// Query builder object}
Componentes
params
El objeto params contiene todos los parámetros disponibles para el reporte actual.
// Example
const firstUser = context.table.users[0];
const totalSales = context.table.sales.reduce((sum, sale) => sum + sale.amount, 0);
context.flow({
flowId: "flow123", // Required: ID of the flow to load
executionType: "loadFlow", // Required: "loadFlow" or "openFlow"
reloadCurrentFlow: true, // Optional: Whether to reload the current page after loading the flow
reloadCurrentContent: true, // Optional: Whether to reload the current content after loading the flow
resetParams: false, // Optional: Whether to reset params to default after loading the flow
params: [ // Optional: Parameters to pass to the flow
{
paramName: "userId",
paramValue: "12345"
},
{
paramName: "view",
paramValue: "detailed"
}
]
});
context.form({
formId: "form123", // Required: ID of the form to open
params: [ // Optional: Parameters to pass to the form
{
paramName: "userId",
paramValue: "12345"
},
{
paramName: "mode",
paramValue: "edit"
}
]
});
// Open an edit form for the first product in the table
context.form({
formId: "productEditForm",
params: [
{
paramName: "productId",
paramValue: context.table.products[0].id
},
{
paramName: "category",
paramValue: context.params.currentCategory
}
]
});
// Update data in the background and then refresh the current view
context.flow({
flowId: "dataUpdateFlow",
executionType: "loadFlow",
reloadCurrentFlow: true,
reloadCurrentContent: true,
resetParams: false
});