Discussion (6)0
Log in or sign up to continue

I (agrup=1) {

            S COD = query.Get("pscodigo")

           

            I (COD="") S COD = "000" DESC = query.Get("psnome")

            I (DESC="") S DESC = "NAO DEFINIDO" (ordenacao=1)

           

            S K2=DESC_"^"_COD S K2=expert.completaString(COD,0,6)_"^"_DESC

}

S K3 = descrProd_"^"_codProduto_"^"_idProduto S ^mtempJOB(controladorjob,K1,K2,K3)=$LB(...)

I was able to solve the problem as follows: 

if ((ordenaProduto 0|| (ordenaProduto 1)) {
        set ordemProd query.Get("fatiqtde")
elseif ((ordenaProduto 2|| (ordenaProduto 3)) {
        set ordemProd query.Get("valortotliq")
}

set ^mtempJOB(controladorjob,K1,K2,ordemProd,K3$listbuild(   codProduto
                                                                    ,descrProd
                                                                    ,(qtdOld+$select(BP2:query.Get("fatiqtde"),1:0))
                                                                    ,(pesoOld+$select(BP2:query.Get("peso"),1:0))
                                                                    ,(vlrOld+query.Get("valortotliq"))
                                                                    ,(brutoOld+query.Get("bruto")))