I have been trying to overcome a mental (!) block for 4 days now trying to get an SQL process called from a method to return my selected data. I had modeled my process on a method included in Innovator but somehow I have gone wrong - terribly wrong . Now I am down to a simple test method just trying to get the process to work.....here is the method I am using (AND I have verified that the id I have 'hard coded' into this is the correct id for the wbs I want to start with. Also, the SQL I have put in Visual Studio (connected to the same database) and it runs and returns exactly what I was looking for - using the id 'hard coded' in the method as input. Where am I going wacko?
Here is my simple test method:
Dim myinv As Innovator = Me.newInnovator
Dim myinn As Innovator = Me.newInnovator
Dim vStr As String
Dim vName As String
Dim vWBS As String
Dim vAct As String
Dim q As Item = Me.newItem()
Dim r As Item = Me.newItem()
Dim s As Item = Me.newItem()
Dim t As Item = Me.newItem()
Dim oCall As Innovator = Me.newInnovator
vStr = "A29101C24DAD4630A57C39C363C85F4F" ' Top WBS id for proj 1324
Dim aml As String = String.Format("" & _
"<AML><Item type='SQL' action='SQL PROCESS'>" & _
"<PROCESS>CALL</PROCESS><name>get_subwbs_oac</name><ARG1>{0}</ARG1>" & _
"</Item></AML>", vStr)
s = myinv.applyAML(aml)
Return (myinn.newResult(s.node.OuterXML))
I get an error that points to the Return line and says there is no instance of the object (presumably the s.node.OuterXML reference) .
and the SQL get_subwbs_oac text is:
/* get list of wbs elements below top wbs in project */
create procedure get_subwbs_oac(@id char(32))
as
begin
SELECT innovator.WBS_ELEMENT.NAME AS WBSName, innovator.WBS_ELEMENT.ID AS WBSid, innovator.ACTIVITY2.NAME AS ActName,
innovator.ACTIVITY2.PROJ_NUM AS ProjNbr, innovator.ACTIVITY2.STATE AS ActState, innovator.SUB_WBS.SOURCE_ID
FROM innovator.SUB_WBS INNER JOIN
innovator.WBS_ELEMENT ON innovator.SUB_WBS.RELATED_ID = innovator.WBS_ELEMENT.ID INNER JOIN
innovator.WBS_ACTIVITY2 ON innovator.WBS_ELEMENT.ID = innovator.WBS_ACTIVITY2.SOURCE_ID INNER JOIN
innovator.ACTIVITY2 ON innovator.WBS_ACTIVITY2.RELATED_ID = innovator.ACTIVITY2.ID
WHERE (innovator.SUB_WBS.SOURCE_ID = @id)
end