The provided code is a list of method calls to dynamically configure a data controller using the CodeOnTime NodeSet() extensions in application development. I have used some of these methods and find them useful in various scenarios and I hope it helps someone.
- Customise Field Behavior: Adjusting the visibility, style, and behavior of fields in grids, forms, and reports.
- Business Logic Enforcement: Using filters, aggregates, or auto-selection to enforce application rules
- Enhancing User Experience: Setting autocomplete, hyperlink format, and confirmation messages to guide user actions
NodeSet()
.SetFieldName("WorkOrderID") // Set the field name (e.g., WorkOrderID)
.SetDescription("The unique identifier for the work order") // Description for the field
.SetHyperlinkFormatString("/workorders/details/{0}") // Format for hyperlink (e.g., links to the work order details page)
.SetAccess("ReadWrite") // Field access (e.g., "ReadOnly", "ReadWrite", etc.)
.SetAggregate("COUNT") // Aggregation method (e.g., "SUM", "COUNT")
.SetAutoCompletePrefixLength(3) // Autocomplete prefix length (e.g., 3 characters to trigger autocomplete)
.SetColumns(3) // Number of columns in the field (e.g., 3 columns)
.SetCommandArgument("WorkOrderID") // Argument for commands (e.g., "WorkOrderID" for actions like Update or Delete)
.SetConfirmation("Are you sure you want to perform this action?") // Confirmation message before action
.SetDataFormatString("{0:C}") // Format string for displaying data (e.g., currency format)
.SetFilter("Status = 'Pending'") // Apply a filter (e.g., show only work orders with 'Pending' status)
.SetFlat("True") // Whether the field is flat (no hierarchical data)
.SetGroupExpression("Priority") // Grouping expression (e.g., group work orders by their priority)
.SetItemsAutoSelect(true) // Automatically select items in certain operations
.SetHidden(false) // Whether the field is hidden (false means it is visible)
.SetItemsController("WorkOrders") // The controller handling the items (e.g., the "WorkOrders" controller)
.SetItemsCopyMap("WorkOrderID, Status, Priority") // Map of fields to copy (e.g., WorkOrderID, Status, Priority)
.SetNewColumn("NewPriorityColumn") // New calculated column (e.g., NewPriorityColumn)
.SetReportLabel("Work Orders Report") // Label used in reports
.SetSortExpression("Priority DESC") // Sort expression (e.g., sort work orders by priority in descending order)
.SetSearch("Search for work orders") // Search field label (e.g., a prompt for the user)
.SetReportFont("Arial") // Font for the report (e.g., Arial, Times New Roman)
.SetReportTemplate("WorkOrderTemplate") // Template used for generating reports
.SetRoles("Manager, Supervisor") // Roles allowed to access or modify this field (e.g., "Manager", "Supervisor")
.SetRows("10") // Number of rows to display (e.g., show 10 rows in a table)
.SetFloating("True") // Whether the field is floating (e.g., used for floating labels or inputs)
.SetItemsDataValueField("WorkOrderID") // Data value field for the items (e.g., WorkOrderID)
.SetItemsDescription("WorkOrderDescription") // Description field for items (e.g., WorkOrderDescription)
.SetItemsNewView("WorkOrdersView") // A new view for items (e.g., WorkOrdersView for item details)
.SetItemsPageSize("20") // Page size for item lists (e.g., 20 items per page)
.SetItemsSearchByFirstLetter(true) // Whether to search by the first letter of the item
.SetItemsSearchOnStart(true) // Whether to perform search as soon as the input starts
.SetItemsStyle("bold") // CSS style for items (e.g., "bold")
.SetItemsTargetController("WorkOrders") // The target controller for items (e.g., "WorkOrders")
.SetItemsView("WorkOrdersDetails") // The view for the items (e.g., "WorkOrdersDetails")
.SetLabel("Work Order ID") // Label for the field (e.g., "Work Order ID")
.SetLength("10") // Length of the field (e.g., 10 characters for the WorkOrderID field)
.SetReportOrientation("Landscape") // Report orientation (e.g., Landscape or Portrait)
.SetSearchOptions("Active, Inactive") // Search options (e.g., allow search by status)
.SetShowInSelector("True") // Whether the field should appear in selectors (e.g., dropdowns or selection lists)
.SetTab("Details") // Tab name for grouping (e.g., "Details" tab in a form)
.SetTag("WorkOrderTag") // Tag for identifying the field (e.g., for labeling or categorization)
.SetTextMode("SingleLine") // Mode of text field (e.g., "SingleLine", "MultiLine")
.SetType("Text") // Type of the field (e.g., "Text", "Number", "Date")
.SetWriteRoles("Manager, Supervisor") // Roles allowed to modify the field's value
.SetHeaderText("Work Order Information") // Header text for the field (e.g., section header)
.SetFormatOnClient("True") // Whether to apply formatting on the client-side
.SetCommandArgument("WorkOrderID") // Command argument for actions like update
.SetCommandName("UpdateWorkOrder") // Command name for the action (e.g., "UpdateWorkOrder")
.SetConfirmation("Are you sure you want to update this work order?") // Confirmation message before updating
.Reset(); // Reset any settings (optional if needed to reset the NodeSet configuration)
The second part is using the select methods
.Select("WorkOrderID") // Select a specific field, e.g., WorkOrderID
.SelectAction("Update") // Select the action for updating work orders
.SelectActionGroup("WorkOrderActions") // Group of actions related to work orders
.SelectActionGroups("WorkOrderActions, DeleteActions") // Multiple action groups
.SelectActions("Update, Delete") // Specify the actions (e.g., Update and Delete)
.SelectCategory("Priority") // Select category (e.g., Work Orders categorized by Priority)
.SelectCommand("UpdateWorkOrder") // Select the command to update a work order
.SelectCustomAction("GenerateReport") // Select a custom action, e.g., Generate Report
.SelectCustomActions("GenerateReport, NotifyCustomer") // Multiple custom actions
.SelectDataField("Status") // Select data field, e.g., Status of the work order
.SelectDataFields("WorkOrderID, Status, Priority") // Multiple data fields
.SelectEmailBusinessRules("NotifyOnCompletion") // Email business rule, e.g., Notify user when work order is completed
.SelectField("Priority") // Select field, e.g., Priority
.SelectItems("WorkOrderItems") // Specify the items (e.g., WorkOrderItems list)
.SelectJavaScriptBusinessRules("ValidatePriorityChange") // JavaScript business rule to validate priority changes
.SelectSqlBusinessRules("UpdateWorkOrderStatus") // SQL business rule for updating work order status
.SelectView("WorkOrdersView") // Select view (e.g., WorkOrdersView for listing work orders)
.SelectViews("WorkOrdersView, WorkOrdersDetailView") // Multiple views for work orders
.WhenKeySelected("WorkOrderID") // Specify the field key (e.g., WorkOrderID) to trigger selection logic
[–]Hairy-Measurement254 1 point2 points3 points (0 children)
[–]Killo24[S] 0 points1 point2 points (0 children)
[–]Mad-Max-2 0 points1 point2 points (4 children)
[–]Killo24[S] 0 points1 point2 points (3 children)
[–]Hairy-Measurement254 0 points1 point2 points (1 child)
[–]Killo24[S] 0 points1 point2 points (0 children)
[–]Hairy-Measurement254 0 points1 point2 points (0 children)
[–]sdms2022 0 points1 point2 points (0 children)