Not a single item

I wrote down the following to get data from a relationship and insert it in an item type but unfortunately im having the following error

I dont see an issue with my logic if someone can take a look i would really appreciate it.

Not a single item

Item ecrtask = this.newItem("ECR Task", "get");
ecrtask.setProperty("source_id", this.getID());
ecrtask = ecrtask.apply();

for(int i=0; i < ecrtask.getItemCount(); i++)
{
Item relDoc = ecrtask.getItemByIndex(i).getRelatedItem();
string title = ecrtask.getProperty("vsy_title","");
relDoc.setProperty("vsy_title",title);
string relDocid = relDoc.getProperty("id","");

string sql = "update [innovator].[VSY_Task] set vsy_title = '" + title + "' where id = '" + relDocid + "'";
Item result = inn.applySQL(sql);
}

Parents Reply
  • Hi,

    Item ecrtask = this.newItem("ECR Task", "get");
    ecrtask.setProperty("source_id", this.getID());
    ecrtask = ecrtask.apply();
    int countOfECR=ecrtask.getItemCount();
    return this.getInnovator().newError(countOfECR.ToString())  ///Try to get Count and see if it is returning Zero records or more

    for(int i=0; i < ecrtask.getItemCount(); i++)
    {
    Item relDoc = ecrtask.getItemByIndex(i).getRelatedItem();
    string title = ecrtask.getProperty("vsy_title","");

    string relDocid = relDoc.getProperty("id","");

    Item vsyTask=this.getInnovator().newItem("VSY_Task","edit");
    vsyTask.setAttribute("where","[VSY_Task].id='"+relDocid+"'");

    vsyTask.setProperty("vsy_title",title);


    vsyTask=vsyTask.apply();
    }

Children