Tripb44
(Kyle Vogt)
January 25, 2021, 4:53am
1
Reference code below. I am trying to set q_xrow.Number04 to be set to “3” if Character13 is not blank but it does not seem to be setting number04 with the code I have so far. Both of these fields are in the Quotehed_UD table for context.
if(q_xrow.Character13 == "" )
{if(q_xrow.ShortChar07 != null && q_xrow.ShortChar07 != "C20469")
{
CEFirm = (from c_row in Db.Customer
where c_row.Company == q_xrow.Company && c_row.CustID == q_xrow.ShortChar07
select c_row).FirstOrDefault();
if(CEFirm != null)
{
originrep = CEFirm.Name;
}
}
else
{
originrep = soldtorep;
}
q_xrow.Character13 = originrep;
q_xrow.Number04 = '3';
update_OR = true;
}
Zoher_Ali
(Zoher Ali)
January 25, 2021, 8:41am
2
Hi,
The issue could be because you’re trying to assign character 3 to Number field.
Try removing single quote around 3.
Number04 = 3
Tripb44
(Kyle Vogt)
January 25, 2021, 2:33pm
3
That still does not work.
adaniell
(Adam)
January 25, 2021, 2:44pm
4
Is Character13 getting updated?
How are you referencing q_xrow, can you show a little more of the code? Is this a method or data directive(pre or post, standard or in-trans)?
Tripb44
(Kyle Vogt)
January 25, 2021, 2:54pm
5
It’s a method directive, pre-processing. Below is how the q_xrow is being set.
//declaring variables
string ShipToState = “”;
string ShipToZip = “”;
string SoldToState = “”;
string SoldToZip = “”;
string soldtorep = “”;
string shiptorep = “”;
string originrep = “”;
string shiptozipcode = “”;
bool update_OR = false;
using(System.Transactions.TransactionScope scope = IceDataContext.CreateDefaultTransactionScope())
{{
foreach (var qd_xrow in (from qd_xrow in ttQuoteDtl
where qd_xrow.Company == Session.CompanyID && qd_xrow.RowMod == “A”
select qd_xrow))
{
foreach (var q_xrow in (from q_xrow in Db.QuoteHed
where q_xrow.Company == Session.CompanyID && q_xrow.QuoteNum == qd_xrow.QuoteNum
select q_xrow))
{
/* look up customer */
Customer = (from c_row in Db.Customer
where c_row.Company == q_xrow.Company && c_row.CustNum == q_xrow.CustNum
select c_row).FirstOrDefault();
if (Customer != null) /* customer record available */
{
/*look up vertical*/
CustIC = (from vert_row in Db.CustIC
where vert_row.Company == Customer.Company && vert_row.CustNum == Customer.CustNum && vert_row.ShipToNum == "" && vert_row.Primary == true
select vert_row).FirstOrDefault();
if (CustIC != null) /* custIC of type record available */
{
vertical = CustIC.ICCode;
}
SoldToState = Convert.ToString(Customer.State);
SoldToZip = Convert.ToString(Customer.Zip);
}
jgiese.wci
(Joshua Giese)
January 25, 2021, 3:01pm
6
For the love of all that is holy please format your code. Code Syntax Highlighting in Posts
There’s a lot of curly braces that lead to no where please paste all the code formatted or it’s too hard to help. WHat is this second little guy here?
Do not directly loop DB move it ToList()
At what point do you actually save the data for q_xrow with Db.Validate() and txscope.Complete()?