cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert NULL Value??

Highlighted
Contributor

How to insert NULL Value??

HI,



I am checking Mandatory information whether its messing or not, so from Excel i want to input NULL value in my Text Field, while execution it prompts for Type Mismatch as it expecting a text value...so is there any way that i can insert NULL value from excel into a text field.



Thanks and Regards




-
Muhammad Mazhar Mahmood
Certified Software Tester (CSTE)
4 REPLIES 4
Highlighted

RE: How to insert NULL Value??

Hi Muhammad,


As I understand, you need to assign a null value to a text box control in your application. If so, the approach you need to use depends solely on the control. If it is possible to enter the null value via some keys combination (e.g. Ctrl + Delete), you can use the Keys method to simulate the keystroke. Also, you can try compiling the tested application with debug information and setting the internal Text property (or any other property which stores the control's text) to null directly from TestComplete.


Best regards,
Alexey

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
New Contributor

RE: How to insert NULL Value??

Just a quick follow up to this,  its kind of in the same area i'm having an issue,

Im new to testcomplet and I have a CSV file where it is in a loop and in different rows, different fields are empty.



so far as 



1. first name, last name, middle name, address  -- all are populated the first time

2. first name, last name, middle name, address  -- first is blank value

3. first name, last name, middle name, address  -- last is blank value

4. first name, last name, middle name, address  -- address is a blank value.



and in the loop it runs through each row and I'm trying to get it to insert the null value into the field and save the new entry.



I keep getting type mismatch and cannot figure out how to get around it or to have the loop remove the values on each one.  I just need to see if its possible to do it without having to have the script on each iteration delete that field entry after.



is this possible?
Wilson Rodriguez
QA Tester
Highlighted
Staff

RE: How to insert NULL Value??

Hi,



After you obtain a value from your file and before using it, check whether it is empty. Use the aqObject.GetVarType method to do this (see the "aqObject.GetVarType" help topic).
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Contributor

RE: How to insert NULL Value??

Hi, i think we cannot insert Null directly from excel, have to do some coding part, so i have tried the following code which is working:



Sub addStudentInformation(firstName, lastName)

'Assuming that values are coming from excel file



If firstName = "" Then

    application.firstName.value = ""  'Inserting Null value to FirstName

Else

    application.firstName.value = Excel.Value(0) 'ExcelColumn

End If



or



If Not firstName = "" Then

    application.firstName.value = Excel.Value(0) 'ExcelColumn

End If



in that case TC will left the first name as it is and move to the next field.



You may have to do this for all fields.
-
Muhammad Mazhar Mahmood
Certified Software Tester (CSTE)
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
A new challenge is here!

Create a function to drag one element to another for the TechCorner tag!

Will you dare to take the challenge?


Scripts created in July:
- Passing custom command-line arguments as a test parameter
Top Kudoed Authors