Wednesday, May 25, 2011

Function to get action datasheet object from Reusable Action Sheet from calling Test

' Function to Access Reusable Action data from calling Action and can use in the Reusable Action itself.

Public Function ActSht_Dt(Test_Path, Action_Name)
' Function to get action datasheet object from reusable Action sheet from calling Test
'# Creator : Baba Fakruddin Dudekula
'# Creation Date : 25-May-2011
' This will help to access the Action sheet data from reusable action from other calling action
If Test_Path <> "" Then
Dim Dt_Cnt, bln_Flag, Test_Name, Action_ShtName, i, Dt_Name, Act_Sht
bln_Flag = False
Dt_Cnt = Datatable.GetSheetCount
Test_Name = Trim(Split(Test_Path, "\")(Ubound(Split(Test_Path, "\"))))
Action_ShtName = Action_Name & " [" & Test_Name & "]"
For i = 1 to Dt_Cnt
Dt_Name = Datatable.GetSheet(i).Name
Act_Sht = Datatable.GetSheet(Action_ShtName).Name
If Trim(Act_Sht) = Trim(Dt_Name) Then
bln_Flag = True
Set ActSht_Dt = Datatable.GetSheet(i)
Exit Function
End If
If Not bln_Flag Then
Set ActSht_Dt = Nothing
End If
End If
' This will help to run the function directly in the reusable Action, No need to pass Test path
If Test_Path = "" Then
Set ActSht_Dt = datatable.GetSheet(Action_Name)
End If
End Function

' Syntax to use this function is : ActSht_Dt(Test_Path, Action_Name).(datatable methods)

"A good threat is worth a thousand tests" - Boris Beizer

No comments: