Assign Code Understanding

Hi @jack.chan and everybody,

I have a piece of code which I need to uderstand if you guys can help me

Math.Round(Convert.ToDouble((From row1 In DtSlInfo Where row1(“Plant”).ToString = row(“Plant”).ToString And row1(“SKU”).ToString = row(“SKU”).ToString Select row1)(0)(“Sum of Revised Plant”)),3).ToString

Can somebody explain me the above piece of code

you can think of it as

Math.Round(A(“Sum of Revised Plant”)),3).ToString

where A =
(From row1 In DtSlInfo Where row1(“Plant”).ToString = row(“Plant”).ToString And row1(“SKU”).ToString = row(“SKU”).ToString Select row1)(0)

A means
select first Row from DtSlInfo where plant = row(“Plant”) and SKU = row(“SKU”)

so A(“Sum of Revised Plant”)
means the “Sum of Revised Plant” value of A

Finally ,
Math.Round(A(“Sum of Revised Plant”)),3).ToString
means
round the above sum to 3 d.p, and convert to string

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.