Not a single item

I'm not sure why I keep getting "Not a single item" Item TDC_BOM = this.newItem("MIN_Delivered_Component","get"); TDC_BOM.setProperty("dpas","Remove"); TDC_BOM = TDC_BOM.apply(); List<string> TDCIds = new List<string>(); for (int v=0 ; v<TDC_BOM.getItemCount() ; v++){ Item dcBom = this.newItem("MIN_Delivered_BOM","delete"); dcBom.setAttribute("where","[MIN_Delivered_BOM].source_id = '"+TDC_BOM.getItemByIndex(v).getID()+"'"); dcBom.apply(); } return this.getInnovator().newResult("BOM items Deleted");  
  • Hello, From looking at the code, it appears that this method should run correctly. Is this the full code of the method? Is this method intended to be called from an Action or a Server Event? Chris
    Christopher Gillis Aras Labs Software Engineer
  • I'm really struggling with this Chris, Here is my entire method that I'm running from a server event, I also tried to run it directly from the method  (Action/Run Server Method) // *** Delete Related ID Components within MIN_Delivered_BOM Item TDC_BOM = this.newItem("MIN_Delivered_Component","get"); TDC_BOM.setProperty("dpas","Remove"); TDC_BOM = TDC_BOM.apply(); List<string> TDCIds = new List<string>(); for (int v=0 ; v<TDC_BOM.getItemCount() ; v++){ Item dcBom = this.newItem("MIN_Delivered_BOM","delete"); dcBom.setAttribute("where","[MIN_Delivered_BOM].related_id = '"+TDC_BOM.getItemByIndex(v).getID()+"'"); CCO.Utilities.WriteDebug("deleteRelated", String.Format("{0} : DCid",TDC_BOM.getItemByIndex(v).getID())); dcBom.apply(); } // *** Delete Source ID Components within MIN_Delivered_BOM Item TDC_BOM2 = this.newItem("MIN_Delivered_Component","get"); TDC_BOM2.setProperty("dpas","Remove"); TDC_BOM2 = TDC_BOM2.apply(); List<string> TDC2Ids = new List<string>(); for (int u=0 ; u<TDC_BOM2.getItemCount() ; u++){ Item dcBom2 = this.newItem("MIN_Delivered_BOM","delete"); dcBom2.setAttribute("where","[MIN_Delivered_BOM].source_id = '"+TDC_BOM2.getItemByIndex(u).getID()+"'"); CCO.Utilities.WriteDebug("deleteSource", String.Format("{0} : DCid",TDC_BOM2.getItemByIndex(u).getID())); dcBom2.apply(); } // *** Delete the Delivered Component Item dcItem = this.newItem("MIN_Delivered_Component","delete"); dcItem.setAttribute("where","[MIN_Delivered_Component].dpas = 'Remove'"); dcItem.apply(); return this.getInnovator().newResult("Delivered Components and its BOM's have been deleted"); This is what my data looks like in SQL: innovator.MIN_DELIVERED_COMPONENT ID                                                                              DPAS 7D5A81BA1B5B4B3CB5D287F1D60CF034    Remove 5786D96D44234DF39414767D63AED498    Remove D92E1F0187E34319B170BE1AA6F96D0C     Remove 630BAF3A500E49A9A1AC99CD17E3374C    Remove   innovator.MIN_DELIVERED_BOM id                                                                                    RELATED_ID                                                          SOURCE_ID 26B39DDFD3B0493F8EEFBAB445F59C42       5786D96D44234DF39414767D63AED498       7D5A81BA1B5B4B3CB5D287F1D60CF034 2E4484C0412F4FBCBDB5F501E4BC9AA3        630BAF3A500E49A9A1AC99CD17E3374C       7D5A81BA1B5B4B3CB5D287F1D60CF034 5D17CD0BBA8340EFB7B7032F895D3911         D92E1F0187E34319B170BE1AA6F96D0C         5786D96D44234DF39414767D63AED498   innovator.MIN_DELIVERED_BOM id                                                                                    SOURCE_ID                                                              RELATED_ID 5D17CD0BBA8340EFB7B7032F895D3911         5786D96D44234DF39414767D63AED498         D92E1F0187E34319B170BE1AA6F96D0C 26B39DDFD3B0493F8EEFBAB445F59C42       7D5A81BA1B5B4B3CB5D287F1D60CF034        5786D96D44234DF39414767D63AED498 2E4484C0412F4FBCBDB5F501E4BC9AA3        7D5A81BA1B5B4B3CB5D287F1D60CF034        630BAF3A500E49A9A1AC99CD17E3374C
  • Hello, Thank you for the additional code. I've tried testing this exact Method in a test environment on my machine, but I wasn't able to reproduce the Not a single item error that you are seeing. There could be another Server Event on one of these ItemTypes line an onBefore/onAfterDelete that could also be throwing this error. Could you try adding a debugger to your Method and stepping through the code to see what line is causing that error? You can do this by following the steps below.
    1. Add the two lines below to the top of your Method
      • `System.Diagnostics.Debugger.Launch(); System.Diagnostics.Debugger.Break();`
    2. Add the following operating_parameter to your InnovatorServerConfig.xml at the root of your code tree
      • <operating_parameter key="DebugServerMethod" value="true"/>
    3. Run the Method as normal
    4. You should be prompted to open Visual Studio which will allow you to step through the execution of the method line by line
    Chris
    Christopher Gillis Aras Labs Software Engineer
  • Chris, It was another server event on this item type. Thanks!!