Hello im trying to get ID of gen 2 in a variable in Csharp can someone tell me how i can do that?
ID Gen
1 1
2 2
3 3
4 4
Hello im trying to get ID of gen 2 in a variable in Csharp can someone tell me how i can do that?
ID Gen
1 1
2 2
3 3
4 4
Hi HKhan
I don't know the contextItem of your method call. Assuming your method call contextItem is part, you can run below code snippet
Innovator innovator = this.getInnovator();
string configId = this.getProperty("config_id");
Item partItem = innovator.newItem("Part","get");
partItem.setProperty("config_id", configId);
partItem.setProperty("generation", "0");
partItem.setAttribute("select", "id,generation");
partItem.setAttribute("maxRecords", "2");
partItem.setAttribute("orderBy", "generation DESC");
partItem.setPropertyCondition("generation", "ge");
partItem = partItem.apply();
if(partItem.isError())
{
return innovator.newError("Error getting partItem " +partItem.getErrorString());
}
if(partItem.getItemCount() > 1)
{
return innovator.newResult("ID of Previous Generation is " +partItem.getItemByIndex(1).getID());
}
else
{
return innovator.newError("Previous Generation does not exist.");
}
can you also tell what partItem.setPropertyCondition("generation", "ge"); does? like what does "ge" mean?
can you also tell what partItem.setPropertyCondition("generation", "ge"); does? like what does "ge" mean?
ge stand for greater than or equal to. Some other condition are:
eq equal
ne not equal
le less than or equal to
gt greater than
lt less than
like
not like
between
not between
in
is null
is not null
Thank You
Gopikrishnan R