0 votes

Hi,

I've added a new field (F_ROLE) in PROJ_COMP. I'm trying to get the value of this new field using a consult detail, (the purpose is to copy link and the new fields value from proj_comp to docu_comp)

I've created a new "Proj : Linked Comp" in SYS_QUERIES, but when i execute my code i always receive an error, F_ROLE not found, so i supposed consultDetail use an other queries ?

var detailCompDataSet = database.consultDetail(0, projContext, projKey, ntComp, true, true, 0);
if (!detailCompDataSet.IsEmpty) {
  detailCompDataSet.first;
  while (!detailCompDataSet.Eof) {
    var compKey = detailCompDataSet.FieldByName("K_COMPANY").AsFloat;
    database.InsertDetail2(docuContext, ntComp, compKey, false);    
    database.UpdateDetail2(docuContext, ntComp, compKey, "F_ROLE", 
detailCompDataSet.FieldByName("F_ROLE").AsFloat);
    detailCompDataSet.Next;
  }
}
asked in WorkFlow / Serverscript by (336 points)
edited by

2 Answers

+1 vote
Best answer

I've found.

My field F_ROLE is a lookup, and i've forgoted to put the nolookup in my sys_queries

answered by (336 points)
You can add them both. First line is the key, second line the text value

PROJ_COMP.F_ROLE nolookup
PROJ_COMP.F_ROLE
0 votes

Hello Vincent,

The query used is well K_MASTER = entity and K_DETAIL = detail.
In the same line of code you try to update DOCU_COMP.F_ROLE with the value read from your query, does the field DOCU_COMP.F_ROLE well exists?

Pascal

answered by (274 points)
edited by
Hi Pascal,

Yes, the field in DOCU_COMP is existing, and i can update it manually in efficy client side relation in docu edit.
I also tested my K_MASTER K_DETAIL query by adding the field F_ROLE in DetailGridColumns, it is also working.

I will try to splut my code line in 2 to see if the error come from the updateDetail2, of from the dataset,FieldByName
it is well this line who generate the error
var role = detailCompDataSet.FieldByName("F_ROLE").AsFloat;
1,173 questions
1,433 answers
1,726 comments
325 users