Forum Discussion

sankar_k's avatar
sankar_k
Occasional Contributor
10 years ago
Solved

Passing special characters to TestComplete through Excel

Hi There



I am developing a generic framework and I am passing Name Mapping, child objects to be searched (set of properties and their values) and the actual values to be entered into the text fields



For example after reading from Excel, TestComplete will form a code block like this



Result = Findarow("SecuritySetup","Grid_Wrapper","CompanyGrid","Company","SAKI2","Company")



SecuritySetup is the alias name, Grid_Wrapper is the object type and CompanyGrid is the object name, I would like find the value "SAKI2" in the column header "Company". After finding the row, I will click at the column "Company"



Now my challenge is that a column name as shown by object spy is "Authorization"&Chr(13)&Chr(10)&"Status". So while passing through excel it will be passed as "Authorization&Chr(13)&Chr(10)&Status". After reading it as a string from Excel, I would like to find the special characters chr(13) and chr(10) and pass them as special characters and not as strings.




Appreciate your inputs


  • You could parse them as you read them in.



    So search the read-in string for "chr(*)" so that it finds and extracts each one. Then simply re-compile the string using the extracted CHR's in an EVAL statement. (Having removed them from the original of course)



    Seems little clunky, but a single function should work on all fields.



    I can pretty much visualise the code in my head in VBScript. But I don't know what you're writing in.



    I do something sort of similar with my framework which reads in tests from Excel fields in that certain combinations of leading characters tell it what a cell contains. "P:" is a parameter, "E:" is an expected result, "M:" is a marker, "D:" is a dependency .... etc etc. These are all parsed out of the cell data as it's read in.

2 Replies

  • You could parse them as you read them in.



    So search the read-in string for "chr(*)" so that it finds and extracts each one. Then simply re-compile the string using the extracted CHR's in an EVAL statement. (Having removed them from the original of course)



    Seems little clunky, but a single function should work on all fields.



    I can pretty much visualise the code in my head in VBScript. But I don't know what you're writing in.



    I do something sort of similar with my framework which reads in tests from Excel fields in that certain combinations of leading characters tell it what a cell contains. "P:" is a parameter, "E:" is an expected result, "M:" is a marker, "D:" is a dependency .... etc etc. These are all parsed out of the cell data as it's read in.
  • sankar_k's avatar
    sankar_k
    Occasional Contributor
    Thanks. I have completed it with a temporary solution and will explore it further as suggested