Quick viewing of a query result


During the modification of the posting procedure of the Services document you went through creating quite a complex query.

You might need to ensure that some data read from the database in a query is correct, and view this data as a table.

You can do it easily in Designer. We will discuss this feature using the query from your posting handler.

Suppose that you want to dump the execution result of Query2 to a value table (VT).

  1. Modify the script as shown in listing 14.34.

    Listing 14.34. Posting() procedure (fragment)

    QueryResult = Query2.Execute();
    VT = QueryResult.Unload();
    SelectionDetailRecords = QueryResult.Select();
  2. Set a breakpoint at the statement SelectionDetailRecords = Result.Select().
  3. Run 1C:Enterprise in the debug mode and repost one of the Services documents (for example, Services #2).

    The script execution is interrupted at that point and the module text is opened in Designer.
  4. Double-click the VT word to select it, and then, on the Configuration Debug toolbar, click the Evaluate expression (Shift + F9)  button.

    This opens the expression preview window with the VT value table.

    A value table is a collection, so you can use the standard method of viewing collection data.
  5. In the Result list, click the VT row and then click the Show Values in Separate Window (F2)  button above the list (fig. 14.29).

    Fig. 14.29. Viewing a value table that stores the query result

    The window that is opened contains the entire value table that stores the query execution result.

    You can use the Output list  button to export the value table to a spreadsheet document if you want to analyze this data or save it for later use.

    After previewing the query result, remember to remove the breakpoint from the document posting procedure and either comment or remove the line that exports the query result into a value table. You do not need it when you perform regular document operations.

Add comment