BPM to Copy UD field Value from Part to QuoteDtl

,

@josecgomez, then how would you go about doing it?

See @knash example above. It is like this:

theRowHere.UDField<TheTypeHere>("FieldNameHere"); 
//using my code above as a reference
i.UDField<decimal>("SKTotalQty_c") = myOrder.UDField<decimal>("TotalQtyUnit_c");
1 Like

I think I got it… this would before the statement:

ttInvcDtl.RCTrkQty_c = OrderDtl_row.RCTrkTtlQty_c;
ttInvcDtl.AveragePerRCTrk_c = OrderDtl_row.AvgPrice_c

Right?

Here is where I am now:

The syntax through ttInvcDtl_xRow.UDField(“RCTrkQTY_c”);
is ok, but it errors on the next line.

That is not a valid statement

Chris,

This is what I have:

ttInvcDtl_xRow.UDField(“RCTrkQty_c”);
//ttInvcDtl_xRow.UDField(“AveragePerRCTrk_c”);

ttInvcDtl_xRow.UDField<decimal>("RCTrkQty_c") = OrderDtl_Row.UDField<decimal>("RCTrkTtlQty_c");

//ttInvcDtl_xRow.UDField(“AveragePerRCTrk_c”) = OrderDtl_row.UDField(“AvgPrice_c”);

My error is now: Left-hand side of an assignment must be a variable, property or indexer.

I am ready to throw in the towel and just let the end users manually update.

This is not a valid statement, It doesnt do anything. Comment it out

I don’t now why but that is not what it says on my screen it is:

ttInvcDtl_xRow.UDField(“RCTrkQty_c”) not ttInvcDtl_xRow.UDField(“RCTrkQty_c”);

In any case, I have commented it out and still getting the same error:

The left-hand side of an assignment must be a variable, property or indexer

I assume formatting on the forum is taking your brackets away - but the issue is that you have to assign something to that

ttInvcDtl_xRow.UDField<decimal>(“RCTrkQty_c”) = 1;  
//or 
ttInvcDtl_xRow.UDField<decimal>("RCTrkQty_c") = OrderDtl_Row.UDField<decimal>("RCTrkTtlQty_c");

In short, comment out that line that isnt doing anything:

ttInvcDtl_xRow.UDField<decimal>("RCTrkQty_c") ;   <-- scrap this!

Chris,

I removed the lines. Please see the code below. Still has the error about the left-hand side

Erp.Tables.OrderDtl OrderDtl;

var ttInvcDtl_results = (from ttInvcDtl_Row in ttInvcDtl
where (ttInvcDtl_Row.RowMod == “U”) select ttInvcDtl_Row);
foreach (var ttInvcDtl_xRow in ttInvcDtl_results)
{
var Company = ttInvcDtl_xRow.Company;
var OrderNum = ttInvcDtl_xRow.OrderNum;
var OrderLine = ttInvcDtl_xRow.OrderLine;
var OrderDtl_Row = (from ttOrderDtl_Row in Db.OrderDtl
where (ttOrderDtl_Row.Company == Company) select ttOrderDtl_Row).FirstOrDefault();

ttInvcDtl_xRow.UDField<decimal>("RCTrkQty_c") = OrderDtl_Row.UDField<decimal>("RCTrkTtlQty_c");

//ttInvcDtl_xRow.UDField(“AveragePerRCTrk_c”) = OrderDtl_row.UDField(“AvgPrice_c”);

}

I have the line exactly the way you have in the comments above. Up to that point it works.

You seem to be struggling with the C#, might I suggest using the BPM widgets to set those fields. The issue is, even if you get this compiling, writing the wrong thing in C# can hinder your performance or worse corrupt your data.

Check out the Fill Table By Query Widget - I think @timshuwy has a few good examples on the forum here

1 Like

Chris,

I did the widgets first. I had a message then Fill Table by Query widget and a final message. It fired off the message as expected and never executed the BPM. I abandoned it because I just couldn’t get it to work. I saw this post and got with a programmer here at work to assist with the code as I am not as proficient as I’d like to be. I did see that 10.2 has a UD Column Map Maintenance Module bit there is no template for OrderDtl to InvcDtl that I can see. This is used evidently to map UD fields from one table to another.

I will keep at it and if I find a solution, I’ll certainly post on here.

Yes but only certain tables that have a direct relationship.

@Chris_Conn, I went back and used your code and updated the last line and it kicked out the same error as I’m getting: The left-hand side of an assignment must be a variable, property or indexer

Maybe I just have something set up wrong. I will try again with the fill by query. I appreciate your help.

Charles

I was able to resolve this issue. I had some code that was not correct. I appreciate everyone’s help.

4 posts were split to a new topic: BPM on Sales Order Question

@Charles.Dingas how did you reference your UD fields at the end of your code? I’m having the same issues that you faced.

Here is the code I used. I did have to get some help on it as I am not a programmer…

Erp.Tables.OrderDtl OrderDtl;

foreach(var ttInvcDtl_iterator in (from ttInvcDtl_Row in ttInvcDtl
where string.Equals(ttInvcDtl_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttInvcDtl_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase)
select ttInvcDtl_Row))
{
var ttInvcDtlRow = ttInvcDtl_iterator;

{
//this.PublishInfoMessage("FoundpodetailDtl", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");

    foreach (var OrderDtl_iterator in (from OrderDtl_Row in Db.OrderDtl
                                       where string.Compare(OrderDtl_Row.Company, ttInvcDtlRow.Company, true) == 0 && 
                                       OrderDtl_Row.OrderNum == ttInvcDtlRow.OrderNum &&
                                       OrderDtl_Row.OrderLine == ttInvcDtlRow.OrderLine
                                                         select OrderDtl_Row))
                                                         
                                                         if (OrderDtl_iterator != null)
                                                         
                                                         {

                                                          if(OrderDtl_iterator.AvgPrice_c != null && OrderDtl_iterator.TotalQtyUnits_c != null)
    {
     //this.PublishInfoMessage("FoundOrderDtl", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
        OrderDtl = OrderDtl_iterator;
        ttInvcDtlRow["AvgPerPer_c"] = OrderDtl.AvgPrice_c;
        ttInvcDtlRow["SKTotalQty_c"] = OrderDtl.TotalQtyUnits_c;
    }
   }
  }
  }

Thanks,

Charles

1 Like

Thanks @Charles.Dingas

Anytime. Let me know if it works. It is just a matter of making sure you choose the correct tables.