Retrieving Value from Actions Datatable - QTP
Local and global datasheets have a relationship to the current Action by default. You can issue these commands on the first line of your action, and you'll get values:
- DataTable.GlobalSheet.Name
- DataTable.LocalSheet.Name
However, HP does not prevent you from accessing any sheet you want: the mere presence of an ImportSheet function underscores the fact that you can utilize external tables if the 2 tables are not enough. Using another action's sheet is no different from using a sheet from an imported excel file.
You have a point and it does make sense to limit access to local datasheets only to the owning Action, just as how local variables are limited only to the function that defined them. But do remember that an Action's DataSheet is an entirely independent object. Its only irrevocable relationship is with its parent excel file. That's probably the reason why HP did not put such a restriction.
user1925406
Updated on October 08, 2020Comments
-
user1925406 over 3 years
In QTP it is said that actions datatable are local and values in it could be accessed only the code in the specific actions (like value in Action1 datatable could accessed only by Action1 script), and thats why we have to use global sheet.
But I came across the below function which would take data from different actions table, like if data in Action1 data table and code in Action 2.
Could anyone calrify me if this is feasible and if yes why is it generalized that values in Action data table is local and only values in Global datasheet could be accessed from anywhere?
DataTable.Getsheet("Action1").GetParameter(A).Value