This
example will return a DataTable with one row for each item that is referenced
by the part type “DFR” from the starting item.
Please
see the Help for information on path expressions.
Both of these commands can potentially be very expensive performance-wise on the
server.
If
you want to work with the found items (update and save back to the server), you
should use the functions ExecutePathAsItems or GetItems which returns
SystemWeaver objects instead.
Best regards,
1 Comment
SystemWeaver Support
说
约6年 以前
回答
Hello Stacey,
There
are two API functions that return a DataTable instead of IswItems.
One
operates on the complete database and uses filter.
This
example will return a DataTable with one row for each item that is referenced
by the part type “DFR” from the starting item.
Please
see the Help for information on path expressions.
Both of these commands can potentially be very expensive performance-wise on the
server.
If
you want to work with the found items (update and save back to the server), you
should use the functions ExecutePathAsItems or GetItems which returns
SystemWeaver objects instead.
Stacey Hwasser
Can you provide an example of how to call GetItemsAsDataTable? Can it be used with a single item or only with the complete data set?
Hello Stacey,
There are two API functions that return a DataTable instead of IswItems.
One operates on the complete database and uses filter.
DataTable dt = SWConnection.Instance.Broker.Q.GetItemsAsDataTable("<Filter/>", new[] { "Name", "Version" });
This command creates a DataTable with one row per item in the database. Each row will have two columns containing the name and version of the item.
To create the filter string, you can use the “General search” dialog from the “Open item” menu and view the XML tab.
The other uses a start item and a path expression to find objects related to the starting item.
IswItem startItem = SWConnection.Instance.Broker.GetItem(SWHandleUtility.ToHandle("x040000000000432"));
DataTable dt = SWConnection.Instance.Broker.Q.ExecutePathAsDataTable(startItem, "/DFR", new string[] { "Name", "Version" });
This example will return a DataTable with one row for each item that is referenced by the part type “DFR” from the starting item.
Please see the Help for information on path expressions.
Both of these commands can potentially be very expensive performance-wise on the server.
If you want to work with the found items (update and save back to the server), you should use the functions ExecutePathAsItems or GetItems which returns SystemWeaver objects instead.
Best regards,
SystemWeaver Support
Hello Stacey,
There are two API functions that return a DataTable instead of IswItems.
One operates on the complete database and uses filter.
DataTable dt = SWConnection.Instance.Broker.Q.GetItemsAsDataTable("<Filter/>", new[] { "Name", "Version" });
This command creates a DataTable with one row per item in the database. Each row will have two columns containing the name and version of the item.
To create the filter string, you can use the “General search” dialog from the “Open item” menu and view the XML tab.
The other uses a start item and a path expression to find objects related to the starting item.
IswItem startItem = SWConnection.Instance.Broker.GetItem(SWHandleUtility.ToHandle("x040000000000432"));
DataTable dt = SWConnection.Instance.Broker.Q.ExecutePathAsDataTable(startItem, "/DFR", new string[] { "Name", "Version" });
This example will return a DataTable with one row for each item that is referenced by the part type “DFR” from the starting item.
Please see the Help for information on path expressions.
Both of these commands can potentially be very expensive performance-wise on the server.
If you want to work with the found items (update and save back to the server), you should use the functions ExecutePathAsItems or GetItems which returns SystemWeaver objects instead.
Best regards,
-
Support for Autotest of API applications
-
Major version exception in API
-
Part multiplicity exception in API
-
Get enum attribute value description
-
Detecting connection status?
-
Item type name from SID
-
Adding an existing item as part to an item using C# API
-
Last Changed date isn't updating
-
Script filer och API
查看所有19话题