Micro Focus QTP (UFT) Forums
How to set the value to the Datatable ? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to set the value to the Datatable ? (/Thread-How-to-set-the-value-to-the-Datatable)



How to set the value to the Datatable ? - Uma - 10-06-2011

Hi,
I am getting a value through input box and I am storing that in a variable.
I am getting this my value thru input box,
Code:
Dim i
i=inputbox("enter sysenv")

I need to store this i value to global data table for furthur Action use.
I am able to see lot of examples that,how to set the direct values to the global or local data sheet.

How to set this variable "i"-Value to the global data table?
Any Help?
Thanks
Uma


RE: How to set the value to the Datatable ? - petes85gt - 10-07-2011

DataTable.Value ("name of column", dtGlobalSheet) = i


RE: How to set the value to the Datatable ? - Uma - 10-07-2011

Hi Petes,
Thank you.It is working
Uma



RE: How to set the value to the Datatable ? - varunkum - 10-11-2011

I was trying to insert value in Global sheet in data table from variable and for this using the following mentioned code. But the code is not storing the value.
If any one knows how to do than pls let me know.

Code:
Dim res
res = 4
msgbox res
DataTable.Value("RequestID","Global") =  res

Here, RequestID is the column name.


RE: How to set the value to the Datatable ? - Ankesh - 10-11-2011

Ur code is absolutly fine. Please check where u have added the column to your global data sheet.

u can use the below as well.
Code:
Datatable.value("<ColumnName>",dtGlobalSheet)="<Value>"

Regards,
Ankesh


RE: How to set the value to the Datatable ? - sreekanth chilam - 10-11-2011

Hi Uma,

Your script is fine.
You just have to do the below.

After executing the script -> go to test results -> click on "Run-Time Data table" -> you can find the value in Global sheet.




RE: How to set the value to the Datatable ? - Uma - 10-11-2011

Hi Varun,
Pls use the following code and check ur runtime datatable

Code:
Dim res
res = 4
DataTable.Value("RequestID",dtGlobalSheet)=res
it has the value

see the attached file/
Thank you
Uma


RE: How to set the value to the Datatable ? - Neetha - 08-06-2015

Hi,

I have the similar kind of problem. I am trying to write values on to global data table during run time. When I specified "A" for column name in the above line of code, it is throwing me an error that the column specified does not exist.

Code:
Datatable.value("<ColumnName>",dtGlobalSheet)="Value"

Here, what column name are we referring to? I see column names A, B, C, D....etc. on Global and Action data tables.
Please provide with examples.
Any help is greatly appreciated.
Thanks.