Forum Discussion

rdsfernanda's avatar
rdsfernanda
Occasional Contributor
9 years ago

How can I compare data from excel driver and field value.

Please, I need your help. I'm trying to compare two informations, one from excel file and one from my aplication. But for that I need to do a loop to compare 10 times and my code it doesn't working.

 

My code doesn't show me the error. But my loop just compare the correct form the first time, after that just show me the messagem "ERROR", even with the same information in both(excel file and field from my application).

 

Sub ComparingData


Dim value1 'variable data from excel file
Dim value2 'variable data from my application - VCLOBJECT


Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").MainMenu.Click("Movimentos|Entrada|Documento de Entrada") 'accessing my the form aplication

call DDT.ExcelDriver("C:\MyFile.xls", "Sheet1") 'call my excel file and the sheet

While not DDT.CurrentDriver.EOF 'starting the loop that will do the comparison between the data

Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("panPadrao5").VCLObject("ediNumeroDocumento").DblClick(12, 15) 'clicking and selecting the field that I will looking for in my database register(Primary Key)
Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("panPadrao5").VCLObject("ediNumeroDocumento").Keys(DDT.CurrentDriver.Value("")) 'Numero_DE = Primary Key, that I use to looking for in my database register.
Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("butPesquisar").DblClick(17, 3) 'search button
Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("pgcDados").ClickTab(" Adicional ")'changind the window, that I will find and compare the field


Set value1= DDT.ExcelDriver("C:\MyFile.xls", "Sheet1")'attributing to "value1" variable the value from my excel driver
Set value2 = Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient", "", 1).VCLObject("frmDocumentoEntrada").VCLObject("pgcDados").VCLObject("tbsAdicional").VCLObject("dbeValorTotalDocumento")'attributing to "value2" variable the value from my application field

if(value1.Value("column") = value2 .wText) then'if value1 = value2, show the message "OK"
log.Message("OK")
else
log.Message("ERROR") 'if not, show the message "ERROR"
end if
Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("pgcDados").ClickTab(" Principal ")'back to my main form

DDT.CurrentDriver.Next()
wend

DDT.CloseDriver(DDT.CurrentDriver.Name)
Call Sys.Process("StoreWMAS").VCLObject("frmPrincipal").Window("MDIClient").VCLObject("frmDocumentoEntrada").VCLObject("butFechar").Click(41, 15) 'closing my application

End Sub

 

I'm working with TestComplete version 9.31.3889.7.

 

thank you

No RepliesBe the first to reply