Using additional custom indexes in SQL for custom ItemTypes - any best practice tips?
Hi community, for a couple of tables I use additional SQL indexes for performance reasons. I noticed that the SQL ItemType allows us to specify custom indexes too and even contains a few for the most common used ItemTypes. Aras for example typically uses them for versioned ItemTypes like classic Part and CAD. The Aras SQL ItemType has one big advantage -> it´s a visible item that can be exported. Indexes used directly in the SQL database are less obvious to see for admins. I wonder if we should use something similar in our own custom ItemTypes in general. Especially for versioned ItemTypes. Of course SQL indexes are mainly used for performance reasons. There are multiple ways to optimize performance. But has anyone some tips when custom indexes should be considered by default (!) in the context of Innovator? @ Aras: Do you have any official recommendations or guidelines regarding SQL indexes? Many thanks for any hint! Best regards Angela0Views0likes0CommentsHow to use a query to get distinct values from a item table
Community, I have created a staging table capability that will be used to generate innovator eBOMs from Oracle manufacturing BOMs. My challenge is working with 1.7 million rows of data in SQL Server. I know I could create a SQL procedure to get the unique (distinct) oracle Assembly IDs but I would like to use a Query Definition. In the data model below, what is circled in RED is the Oracle Data. What is circled in Blue is where I am separating a 1) [multi-Division, multi-Ora Org, with non distinct Assemblies (by Ora Org)] : stg_Oracle_MfgItem_MfgItem INTO 2) [single-Division, multi-Ora Org, Distinct Primary Assemblies] stg_eBOM_PartBOM_Primary AND 3) [single-Division, multi-Ora Org, Other Assemblies (without Primary PartBOM)] stg_eBOM_PartBOM_Other The goal is as follows: 2) stg_eBOM_PartBOM_Primary will be used to generate the innovator [Part BOM] relationships 3) stg_eBOM_PartBOM_Other will be compared to stg_eBOM_PartBOM_Primary to derive Substitutes So I would like to use a Query Definition to gather all the Distinct Oracle Assembly IDs so I can populate the stg_eBOM_PartBOM_Primary table. Thanks in advance for your time and insight. Scott0Views0likes6CommentsConnecting to Linked Server (External SQL Database)
Hello all, After many attempts and support of Aras Support, we are still unable to execute SQL Stored Procedures on an external SQL database. Context Aras Innovator Version 26 SQL Server 2017 Goal Execute a Stored Procedure on an external SQL server (NOT the Aras SQL server itself) from a C# Server Method. Attempts Making a connection using Microsoft.Data.SqlClient and the legacy System.Data.SqlClient. This involves using a connection string and executing a plain command. Used code: [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:f6796336-b0f8-4284-bca3-4d7d91f97dd5:type=csharp&text=Innovator%20inn%20%3D%20this.getInnovator%28%29%3B%0A%0Astring%20connectionString%20%3D%20%40%22Data%20Source%3DServerName%5CInstanceName%3BInitial%20Catalog%3DDatabaseName%3BUser%20ID%3DUserID%3BPassword%3DPassword%3BConnection%20Timeout%3DTimeoutValue%3B%22%3B%0Astring%20sqlQuery%20%3D%20%40%22Exec%20%5BServerName%5CInstanceName%5D.%5BDatabaseName%5D.%5Bdbo%5D.%5BStoredProcName%5D%20%40Variant%20%3D%20VariantValue%2C%20%40State%20%3D%20%27StateValue%27%2C%20%40ID%20%3D%20%27GUID%27%2C%20%40Test%3DTestValue%3B%22%3B%0A%0A%0Ausing%20%28Microsoft.Data.SqlClient.SqlConnection%20connection%20%3D%20new%20Microsoft.Data.SqlClient.SqlConnection%28connectionString%29%29%0A%7B%0Aconnection.Open%28%29%3B%0A%0Ausing%20%28Microsoft.Data.SqlClient.SqlCommand%20command%20%3D%20new%20Microsoft.Data.SqlClient.SqlCommand%28sqlQuery%2C%20connection%29%29%0A%7B%0Aobject%20result%20%3D%20command.ExecuteScalar%28%29%3B%20%2F%2F%20Executes%20query%20and%20returns%20the%20first%20column%20of%20the%20first%20row%0A%0Aif%28result%20%21%3D%20null%29%0A%7B%0Areturn%20inn.newError%28result.ToString%28%29%29%3B%20%2F%2F%20Logs%20the%20value%0A%7D%0Aelse%0A%7B%0Areturn%20inn.newError%28%22No%20result%20found.%22%29%3B%0A%7D%0A%7D%0A%7D] Result: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Adding the external server as 'Linked Server' to the Aras SQL server. Then using innovator.applySQL() referencing the external database. Used code: [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4f6ce192-841a-4134-8fa4-3bb5694c5708:type=csharp&text=Innovator%20inn%20%3D%20this.getInnovator%28%29%3B%0A%0Astring%20sqlQuery%20%3D%20%40%22Exec%20%5BServerName%5CInstanceName%5D.%5BDatabaseName%5D.%5Bdbo%5D.%5BStoredProcName%5D%20%40Variant%20%3D%20VariantValue%2C%20%40State%20%3D%20%27StateValue%27%2C%20%40ID%20%3D%20%27GUID%27%2C%20%40Test%3DTestValue%3B%22%3B%0A%0AItem%20response%20%3D%20inn.applySQL%28sqlQuery%29%3B] Result: This makes the browser client crash and we suspect another timeout in the back-end. Question Does anyone have a method (or workaround) to execute SQL on an external SQL server (NOT the Aras SQL server itself) from a C# server method? Best regards, Daan0Views0likes0CommentsLooking for equivalent of SQL select max(property) in IOM
I am looking for the equivalent to select max(property) in IOM. The below SQL query returns exactly what I want, but I understand that this should be used as a last resort and want to make sure I'm not missing something. select MAX(item_number) FROM [InnovatorServer27_Dev_HL].[innovator].[PART] where part.item_number like '1010P%' result: 1010P000002 This is the function within my method that I'm working with. string GetNextBaseNumber(Innovator inn, string PartNumberPrefix) { int BaseNumber = 1; // This query is currently returning a collection when I want it to return the max value Item Part = inn.newItem("Part", "get"); Part.setProperty("item_number", PartNumberPrefix + "%"); Part.setPropertyAttribute("item_number", "condition", "like"); Part = Part.apply(); if (!Part.isEmpty()) { BaseNumber = Int32.Parse(Part.getProperty("item_number").Substring(5,6))+1; } return PartNumberPrefix + BaseNumber.ToString().PadLeft(6, '0'); }Solved0Views0likes2CommentsAras losing data
Hi Team, I am experiencing a serious problem with my one Aras instance. We are losing data in the system, it is just disappearing without a trace. The user would add data, and then checking the next day, it is gone, without a trace, not even in the history file. My gut feeling is that transactions in SQL was being rolled back, without being committed. I pulled a report from SQL and there seems to be rollbacks aligned with the data loss. As part of this Aras instance I am creating a CAD interface in C# .NET. I am exclusively using applyAML() to talk to Aras, I am not using applySQL. Could I be doing something wrong in .NET? Kind Regards RiaanSolved0Views0likes7CommentsC# SQL Date Query
Good day all, I am trying to create a dynamic report to produce the time it take between starting an activity and ending an activity. I can get the information I am looking for by using SQL, but it will not limit the returns based on dates. I have tried a few different ways to do this, but nothing is working for me. Thanks for any help you can provide. [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:ed95bac7-b9b0-4d83-9998-62b7a1797922:type=text&text=StringBuilder%20sql%20%3D%20new%20StringBuilder%28%29%3B%0A%20%20%20%20sql.AppendLine%28%0A%20%20%20%20%20%20%20%20%22Select%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22WP.name%20AS%20change%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22WP.state%20AS%20status%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Act.name%20AS%20activity%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22ClosedBy.keyed_name%20AS%20closed_by%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Act_Assign.created_on%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Act_Assign.closed_on%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Act_Assign.modified_on%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22GETDATE%28%29%20AS%20today%2C%20%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22DATEDIFF%20%28d%2C%20%5BAct_Assign%5D.created_on%2C%20%5BAct_Assign%5D.closed_on%29%20%2B%201%20AS%20date_diff%20%22%20%2B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%22FROM%20%5BWorkflow_Process%5D%20AS%20WP%20%22%20%2B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%22INNER%20JOIN%20%5BWorkflow_Process_Activity%5D%20AS%20WPA%20ON%20WPA.source_id%20%3D%20WP.id%20%22%20%2B%0A%20%20%20%20%20%20%20%20%22INNER%20JOIN%20%5BActivity%5D%20AS%20Act%20ON%20Act.id%20%3D%20WPA.related_id%20%22%20%2B%0A%20%20%20%20%20%20%20%20%22INNER%20JOIN%20%5BActivity_Assignment%5D%20AS%20Act_Assign%20ON%20Act_Assign.source_id%20%3D%20Act.id%20%22%20%2B%0A%20%20%20%20%20%20%20%20%22INNER%20JOIN%20%5Bsm_Change%5D%20as%20Change%20ON%20Change.item_number%20%3D%20WP.name%20%22%20%2B%0A%20%20%20%20%20%20%20%20%22LEFT%20OUTER%20JOIN%20%5BUser%5D%20AS%20ClosedBy%20ON%20ClosedBy.id%20%3D%20Act_Assign.closed_by%20%22%20%2B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%22WHERE%20WP.name%20%3D%20%27CR-1091%27%20OR%20WP.name%20%3D%20%27CR-1169%27%20%22%20%2B%20%2F%2F%20AND%20Act.name%20%3D%20%27ECR%20Approval%27%20%0A%20%20%20%20%20%20%20%20%22AND%20Act_Assign.modified_on%20BETWEEN%20%272023-08-01%27%20AND%20%272023-08-02%27%20%22%20%2B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%22ORDER%20BY%20WP.name%2C%20Act_Assign.created_on%20ASC%2C%20Act_Assign.closed_on%20DESC%20%22%0A%20%20%20%20%29%3B]Solved0Views0likes7CommentsInnovator SQL Procedures vs. Date Format - how to prevent conversion to American date format?
Hi community, I use an Innovator SQL procedure to get some data that is merged with a second database. The SQL procedure is called from a server Method When I test the procedure in SQL, date properties like modified_on are shown as in correct regular Innovator db format: But the SQL procedure doesn´t return the date in this neutral UTC format to the Server Method. Instead of the shown date in the SQL, I get a converted date that looks like this: 7/13/2002 1:49:27 PM In my case the date is later displayed in a Form, but in my country nobody uses this date format. I am able convert the date into correct DMY-format in C# or SQL. But these steps are unnecessary complicated cause of the American date in between. I wonder why I get the American MDY-date at the first place. I use German locals for Innovator and the server itself. Does anyone know, what can cause dates to be converted to American format when using SQL procedures? Is there away to prevent it? Thanks for any hint! Angela0Views0likes0CommentsHow do I set a where statement on a Query Definition against the current date the query is run?
I want to only have it pull a specific relationship (Part AML) if a custom date field "Valid To" is greater than the current date. I am able to create the Where that compares it against a specific date, but this query definition is pulled by another process automatically and I don't want to have to update the Query Definition every day with the current date for whoever ends up running it that day. I currently have: [Valid to] > '2021-11-29T00:00:00' I want something like (this doesn't work) [Valid to] > current_date()3.3KViews0likes5CommentsVery large ItemTypes/tables in Innovator with SQL Express - what is your experience?
Hi Community, can anyone of you share some experience when using ItemTypes that contain a large number of items? I have a Innovator ItemType that is intended to store up to 1-2 Million items for the start. For me this amount of data is already "a lot". But I assume for other users this is still a very small amount of data. Anyway, I assume that ItemTypes intended for huge amounts of data also requires admins to pay extra attention to ensure system performance. Do you have practical experience in working with large amount of data? Then I would be happy if you could give me some tips! 1. Did you ever face performance issues, especially when using SQL Server Express (which as some performance limitations by default)? 2. Can you recommend me some tips to optimize my ItemType for large data in general? E.g. I want to prevent that users try to display all items as once in the grid. Can I limit this one with max records or are there better options? 3. Anything else that is important to know? Many thanks for any input and best regards! Angela859Views0likes0Comments