graybeardtx - Monday, December 26, 2011 5:20 PM:
Casual Programmer here - planning on taking the Programming Class in February but trying to do some "simple" testing. I copied the sample code from the Programmers Guide Section on page 24 - for a Generic Method. The Syntax Check comes back OK but if I try to execute the method from the Aras Visual Studio, I get an error:
Line number -39, Error Number: CS1513, } expected Line number -39, Error Number: CS1022, Type or namespace definition, or end-of-file expected <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault xmlns:af="http://www.aras.com/InnovatorFault"><faultcode>SOAP-ENV:Server</faultcode><faultstring>Line number -39, Error Number: CS1513, } expected
Line number -39, Error Number: CS1022, Type or namespace definition, or end-of-file expected
</faultstring><detail><af:legacy_detail>Line number -39, Error Number: CS1513, } expected
Line number -39, Error Number: CS1022, Type or namespace definition, or end-of-file expected
</af:legacy_detail><af:exception message="Line number -39, Error Number: CS1513, } expected
Line number -39, Error Number: CS1022, Type or namespace definition, or end-of-file expected
" type="System.ApplicationException" /></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Here is the sample code verbatim:
Innovator innovator = this.getInnovator();
Item item = this.newItem("User", "get");
Item results = item.apply();
int count = results.getItemCount();
if (count<1) return innovator.newError("No users found.");
StringBuilder content = new StringBuilder();
content.Append("<table>");
for (int i=0; i<count; ++i)
{
Item user = results.getItemByIndex(i);
content.Append("<tr><td>Login Name:</td><td>");
content.Append(user.getProperty("login_name"));
content.Append("</td></tr>");
}
content.Append("</table>");
return innovator.newResult(content.ToString());
justinlee - Monday, December 26, 2011 10:42 PM:
Hi John,
I use sample code and i think you must use innovator Objetct in Line 2 for "this".
This code will return a Item Object.
You can see my code bellow.
// C# code for Server side
cmdMain();
return itemX;
}
Innovator Inno;
Item itemX;
private Item GetUser()
{
Item item = Inno.newItem("User", "get");
Item results = item.apply();
int count = results.getItemCount();
if (count < 1) return Inno.newError("No users found.");
StringBuilder content = new StringBuilder();
content.Append("<table>");
for (int i = 0; i < count; ++i)
{
Item user = results.getItemByIndex(i);
content.Append("<tr><td>Login Name:</td><td>");
content.Append(user.getProperty("login_name"));
content.Append("</td></tr>");
}
content.Append("</table>");
return Inno.newResult(content.ToString());
}
private void cmdMain()
{
Inno= this.getInnovator();
itemX = GetUser();
// javascript code for client side
var inno = top.aras;
var item = inno.newIOMItem("ItemType","plmCSharp");
item = item.apply();
alert(item);
P/s: Sorry my English
Lee!