Breadcrumbs

SI.QUERY

Overview

To get the data from your Intacct instance into your workbook, you can use the SI.QUERY function, which returns the contents of the specified Sage object (as either an Excel array or - optionally - as an Excel table).

You can use the Query feature in Velixo NX to build SI.QUERY formulas interactively. See the dedicated article

For querying individual fields from objects, we recommend using the SI.QUERYLOOKUP function instead for better resource efficiency.

Syntax

=SI.QUERY(
    ConnectionName,
    Object,
    Filter,
    Select,
    IncludeHeader,
    Settings,
    OutputColumn1,
    ...
)

Arguments

Argument

Required/Optional

Description

ConnectionName

Optional

Provide one of the following values:

OR

Omit the argument to return results for all compatible connections with default aggregation settings.

Object

Required

Sage Intacct object name (e.g., GLACCOUNT, INVDOCUMENT).
Use "Object (Subtype)" to retrieve column definitions for a specific subtype.


Example

=SI.OBJECTDEFINITION(
    "Sage",
    "INVDOCUMENT (Adjustment Decrease Value)"
)


Use the SI.EXPANDOBJECTRANGE function to get the list of Sage Intacct objects.

Although listed as a valid object, Sage Intact does not support querying the GLRESTRICTIONRELEASE object.

Filter

Optional

This argument is
case-sensitive by default and must be enclosed within quote marks

SQL-like query based on fields on the object. The following operators are supported: <, >, >=, <=, =, like, not like, in, not in, IS NOT NULL, IS NULL, AND, OR.

Joins are not supported.

You can use the SI.QUERYFILTER function to generate filters ready to use with SI.QUERY.

Select

Optional

Comma-separated list of columns to be included in the resulting dataset. If this argument is empty, all the columns from the object will be returned.

Supports Sage Intacct aggregation operators: sum, max, min, avg, count. See below for examples.

A column may come from:

  • The object itself

  • A related object (refer to Sage Intacct: Platform Services Object for information about relationships)

  • Columns from a related object must specify both the related object and the Column name, e.g., CUSTOMER.NAME

  • It is also possible to return columns from multiple levels deep,
    e.g. MANAGER.EMPLOYEEPOSITION.NAME

Objects that do not use either the ID or RECORDNO field, are not queryable using this function. See the Unsupported Objects section for a full list.

IncludeHeader

Optional

TRUE or FALSE, indicating if column headers should be included in the dataset.

Settings

Optional

You can either enter a number to set how many rows you want or use a list of settings (key-value pairs) to specify advanced query settings.

  • Number. For example, 200. The rows are sorted by RECORDNO.

  • Two-dimensional array
    Pass one or more keys with their values. Each key controls a different setting:

    • Sort: A comma-separated list of columns to sort by. Add :DESC after a column name to sort it in descending order (for example, RecordNo:DESC).
      Columns without :DESC are sorted ascending.

    • Limit: The maximum number of rows. For example, 200.

    • Offset: The number of rows to skip from the start. This is useful for paging extensive results. We recommend sorting by a unique column (for example, RECORDNO) so the data appears in a predictable order.

    • CaseInsensitive: If set to FALSE, filters ignore uppercase or lowercase differences in the Filter (for example, “Sales,” “SALES,” or “sales” all match the same data). Default value: FALSE

    • ShowPrivate: If set to FALSE, excludes objects of private entities. Default value: TRUE

    • RefreshMode: Possible values are smart and full. When set to full, a full refresh is performed regardless of the refresh type globally selected by the user. Default value: smart

Example:

=SI.QUERY(
    "Sage",
    "TaxDetail",
    "DESCRIPTION LIKE('%Sales%')",    "RecordNo,DetailID,Description,TaxType,Value,Include,GLAccount,TaxAuthority,Status",
    HSTACK(
        {"Sort"; "Limit"; "CaseInsensitive"},
        {"RecordNo:DESC"; 200; TRUE}
    )
)
  • Sorts rows by RecordNo descending.

  • Returns up to 200 rows.

  • Ignores uppercase and lowercase differences in the filter.

OutputColumn1

Optional

Optionally, specifies the cell on the worksheet where the data of the first column specified in the Select argument is to be displayed as part of an Excel table.

...



Excel Online

Loading large datasets with SI.QUERY() is not performant in Excel Online due to the limitations of the Excel platform in the browser. If your dataset contains more than approximately 100,000 records, we strongly recommend using a desktop version of Excel 365 for Windows or Mac OS.

Querying subtypes of objects

The SI.QUERY function can retrieve data for specific subtypes of objects in Sage Intacct. This is particularly useful for template objects with multiple variations, such as:

  • SODOCUMENT (Contract Change Order, Project Contract Invoice)

  • PODOCUMENT (Purchase Order, Subcontract Invoice)

  • INVDOCUMENT (Adjustment Decrease, Inventory Receipt)

Examples

First 10 records

=SI.QUERY(
    "Sage",
    "GLBatch",
    ,
    ,
    ,
    10
)


Description:
Returns the top 10 records returned by the GLBatch object (after any filtering is applied).

Result:

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/YH62xlcvF1zKo2uWkhnhOz7FLkcs-uJYUQ.png

Filter example 1

=SI.QUERY(
    "Sage",
    "TaxSolution",
    "TaxMethod='VAT or GST'",
    "SolutionID,TaxMethod"
)


Description:
Returns the SolutionID and TaxMethod fields from the TaxSolution object where the TaxMethod field is set to VAT or GST:

Result:

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/OXUxGzlf0_LsdZBrV1IeHgualBB61kPG0A.png

Filter example 2

=SI.QUERY(
    "Sage",
    "TaxDetail",
    "DESCRIPTION LIKE('%Sales%')", "RecordNo,DetailID,Description,TaxType,Value,Include,GLAccount,TaxAuthority,Status"
)


Description:
Returns the specified fields (in the order specified) from the TaxDetail object where the Description field contains the case-sensitive substring Sales

Result:

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/4J00vrBugxaInszTt9UqJB_8tg3bfgwRCw.png
=SI.QUERY(
    "Sage", 
    "Project", 
    (PROJECTID='22-002'), 
    "PROJECTID,NAME,MANAGER.EMPLOYEEPOSITION.NAME"
)


Description:
This SI.QUERY example queries the PROJECT object and returns 3 columns for a single, specified ProjectID.

The third specified field (NAME) originates from the EMPLOYEEPOSITION object that is related to the MANAGER object which is then related to the PROJECT object (demonstrating multi-level "lookups").

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/RsIWptyquh_BBitHdX59f8sSUK0qrnj8TQ.png


  • The above formula is equivalent to the formula in the screenshot, demonstrating the use of cell references for function arguments.

  • The query automatically understands which relationships to use when specifying prefixed column names with related object names.


Here are the relationships of the related objects for the above example:

  • From the PROJECT object, the Employee relationship relates to object: MANAGER

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/4PoKXDPb5ewGrgAPJ0poT6Ey8x1TcdEeCA.png
  • From the MANAGER object: the Employee position relationship relates to the EMPLOYEEPOSITION object

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/qt9p9bQPhW6kiSebXsae0ihfCWNsqh39Tw.png
  • The field NAME is then used from the EMPLOYEEPOSITION Object to return the name of the Employee Position

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/Nuo8Ky85eop4nvZdPu8gQ3wsDKuFnwe3fA.png


Send output to an Excel table

This and other examples of creating Excel tables can be found in Table Mirroring.

=SI.QUERY(
    "Sage",
    "Project",
    ,
    "RECORDNO,PROJECTID,PROJECTTYPE,NAME",
    TRUE,
    ,
    A5,
    B5,
    D5,
    C5
)


Description:
Instead of displaying the results of the query starting in the cell containing the SI.QUERY function, the function Cell A2 displays the specified fields from the Project object in an Excel data table located in the cells specified by the OutputColumns arguments (cells A5, B5, D5, and C5)

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/PAL3m8brTzi1A4vxwNAwneSJAgn-FSl69w.png

Aggregation examples

Aggregate a single field

=SI.QUERY(
    "Sage",
    "Project",
    ,
    "PROJECTTYPE, SUM(ACTUALQTY)"
)


Displays a sum of ACTUALQTY grouped by PROJECTTYPE

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/GuR6L5emYlW6sor-jhx2IzYAEy00DxSICg.png

Multiple aggregations for a single field

=SI.QUERY(
    "Sage",
    "Project",
    ,
    "PROJECTTYPE, SUM(ACTUALQTY), AVG(ACTUALQTY)"
)


Displays a sum and average of ACTUALQTY grouped by PROJECTTYPE

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/785uiIRS2f3zHZYQCIdrg4uSEbdJazX_tQ.png

Aggregations for multiple fields

=SI.QUERY(
    "Sage",
    "Project",
    ,
    "PROJECTTYPE, SUM(ACTUALQTY), SUM(BUDGETAMOUNT)"
)


Displays a sum of both ACTUALQTY and BUDGETAMOUNT grouped by PROJECTTYPE

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/li4O-7oWbLv9fQOIikDG0lxYTvWawmmHQg.png

Aggregation with multiple levels of grouping

=SORT(
    SI.QUERY(
        "Sage",
        "PROJECT",
        ,
        "MANAGERCONTACTNAME,PROJECTTYPE,SUM(ACTUALQTY)",
        FALSE
    ),
    {1,2,3},
    1
)


Displays a sum of ACTUALQTY grouped first by MANAGERCONTACTNAME and then by PROJECTYPE. The Excel SORT function is used to combine the grouped aggregations.

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/-z69upel7EcUR1dgUMrCuTAiVV_ZrPTgcA.png


You can change the order of the fields being retrieved in order to change how the data is grouped.

=SORT(
    SI.QUERY(
        "Sage",
        "PROJECT",
        ,
        "PROJECTTYPE, MANAGERCONTACTNAME, SUM(ACTUALQTY)",
        FALSE
    ),
    {1,2,3},
    1
)


Displays a sum of ACTUALQTY grouped first by PROJECTYPE and then by MANAGERCONTACTNAME.

https://s3.ca-central-1.amazonaws.com/cdn.velixo.com/helpdesk/zL4vo-zLZ2jWCcAsURfxdiUBZE16XNKJAg.png

Unsupported objects

The objects listed below do not use the ID or RECORDNO field, and consequently cannot be queried using the SI.QUERY function.

Other objects may not be queryable, depending on your account’s permissions.

  • ACCOUNTLABEL

  • APCLOSESUMMARY

  • APDETAIL

  • APOPENSUMMARY

  • APPOSTEDADVANCEENTRY

  • APPYMTENTRY

  • APRECORD

  • ARCLOSESUMMARY

  • ARDETAIL

  • AROPENSUMMARY

  • ARPOSTEDOVERPAYMENTENTRY

  • ARPYMTENTRY

  • ARRECORD

  • ASSIGNENTITYTOBANKTRANSACTION

  • BANKTXNRULERUN

  • BASEACCOUNT

  • BILLABLEEXPENSES

  • BILLBACKTEMPLATE

  • BUDGETHEADER

  • CHECKLAYOUT

  • CMDETAIL

  • CMRECORD

  • COGSCLOSEDJE

  • COMPANY

  • COMPLIANCEDEFASSOCIATIONS

  • COMPLIANCERECORDDETAIL

  • CONTRACTPAYMENTSCHEDULE

  • CONTRACTRSLVADDLDATA

  • CONTRACTSCHEDULESRESOLVE

  • CONTRACTSCHFORECAST

  • COSTTYPENGROUPPICK

  • COSTTYPEPICK

  • CREDITACCTRECON

  • CUSTOMERCREDITCARD

  • DEGLPOSTING

  • DEGLSUBTOTALPOSTING

  • DEPRSCHRUNSUMMARY

  • DOCRECALLS

  • DOCUMENT

  • DOCUMENTENTRYTRACKDETAIL

  • DOCUMENTPARINVGL

  • DOCUMENTPARPRGL

  • DOCUMENTPARSUBTOTAL

  • DUNNINGCUSTOMER

  • DUNNINGNOTICE

  • EEDETAIL

  • EERECORD

  • ENTITYGLGROUP

  • EXPENSESAPPROVAL

  • FILE1099

  • FINANCIALINSTITUTION

  • FIXEDASSET

  • GCCONSOLIDATIONENTRY

  • GENERATERECEIPT

  • GIRUNSUMMARY

  • GLBUDGET

  • GLIETPOSTING

  • GLOBALRUNOBJECTSUMMARY

  • GLRESTRICTIONRELEASE

  • INTEGRATIONDETAIL

  • INVRECURDOCUMENT

  • INVRECURSUBTOTALS

  • ITEMVENDOR

  • KITCOSTING

  • OAUTHUSER

  • PCLTASK

  • PODOCUMENTAPPROVAL

  • PRENTRY

  • PRENTRYCURRDETAIL

  • PRGLPOSTING

  • PRIORPERIODCOGSPOSTING

  • PROJECTTOTALS

  • PRRECORD

  • PRTAXENTRY

  • RUNOBJECTSUMMARY

  • SUBSIDIARY

  • SUMMARYBYENTITY

  • TASKNGROUPPICK

  • TASKPICK

  • TASKRESOURCEBILLINGRATE

  • TSVARGLRESOLVE

  • WIPACTUALSDRILLDOWN

  • WIPPROJECTMANAGERFORECAST

  • WIPSETUP

  • WIPSETUPACCOUNT