TEXT to msel textmerge noshow update mytable set exam = ?MyCur.CodPetExterno from mytable Where mytable.exame = ?MyCur.nomPeticio ENDTEXT Select myBoListE Scan For myBoListE.gerar = .T. MSG(Upper(Alltrim(myBoListE.exam))) Select crTemp Locate For Upper(Alltrim(crTemp.nomPeticio)) == Upper(Alltrim(myBoListE.exam)) MSG( "crTEMP : " + Upper(Alltrim(crTemp.nomPeticio)) ) If !u_sqlexec(m.msel) Return Endif Select myBoListE Endscan Select myBoListE LocateDon't know what MSG() does. If it is all about displaying the values, your code further be written as:
TEXT to msel textmerge noshow update mytable set exam = ?MyCur.CodPetExterno from mytable Where mytable.exame = ?MyCur.nomPeticio ENDTEXT Select myBoListE Scan For myBoListE.gerar = .T. _screen.Print((Upper(Alltrim(myBoListE.exam))) Select crTemp Locate For Upper(Alltrim(crTemp.nomPeticio)) == Upper(Alltrim(myBoListE.exam)) _screen.Print( "crTEMP : " + Upper(Alltrim(crTemp.nomPeticio)) ) If !u_sqlexec(m.msel) Return Endif Select myBoListE Endscan Select myBoListE LocateRemoving that display and just thinking about functionality it become:
TEXT to msel textmerge noshow update mytable set exam = ?MyCur.CodPetExterno from mytable Where mytable.exame = ?MyCur.nomPeticio ENDTEXT Select myBoListE Scan For myBoListE.gerar = .T. If !u_sqlexec(m.msel) Return Endif Endscan LocateWhich could be written as:
TEXT to msel textmerge noshow update mytable set exam = ?MyCur.CodPetExterno from mytable Where mytable.exame = ?MyCur.nomPeticio ENDTEXT Select myBoListE local array laCount[1] local ix Select count(*) from myBoListE where gear into array laCount for ix=1 to laCount[1] If !u_sqlexec(m.msel) Return Endif EndscanI don't have an idea why you would want to try executing that m.msel N times.