QTP Script to Get Field Values from QC - hp-quality-center

I want to get the count of status(Pass/Fail) of all testcases present in QC by checking the execution grid.
What is the method to retrieve the status and execution date of a test case ?
Currently I am only able to get the test case name.
Code:
Set treeMgr = gTDConn.TestSetTreeManager
Set tstTree = treeMgr.NodeByPath(TestSetPath)
Set tstFactory = tstTree.testSetFactory
Set tsetList = tstFactory.NewList("")
For Each tset In tsetList
msgbox tset.Name
next

Related

Updating fields from changes in scroll levels

I have a page that has 3 levels. Levels 0 & 1 are from the same record. Level 2 is from a second record.
When a change is made to level 1, I would like to apply that change to the same field in Level 2's record.
Basically, this deals with EFF_STATUS in peoplesoft. If an effective row gets added to the record, and the EFF_STATUS is changed to Active or Inactive, I'd like to update the EFF_STATUS in my second record to match.
Here is the code I'm trying to execute and it is giving me an error of.. "Invalid row number 2 for class Rowset method GetRow. (2,263) K_OFFNSV_REC_EX.EFF_STATUS.SaveEdit PCPC:267 Statement:8 "
If %Component = Component.K_OFFNSV_CMP Then
Local Rowset &LEVEL0, &Level1, &Level2;
Local Row &L1Row, &L2Row;
Local number &I, &J;
&LEVEL0 = GetLevel0();
&Level1 = &LEVEL0(1).GetRowset(Scroll.K_OFFNSV_REC);
&I = CurrentRowNumber();
&L1Row = &Level1(&I);
If &L1Row.IsNew Then
&L1Row.K_OFFNSV_REC.LASTUPDDTTM.Value = %Date;
&L1Row.K_OFFNSV_REC.OPRID.Value = %UserId;
End-If;
&Level2 = &L1Row.GetRowset(Scroll.K_OFFNSV_REC_EX);
For &J = 1 To &Level2.ActiveRowCount
&L2Row = &Level2(&J);
&L2Row.K_OFFNSV_REC_EX.EFFDT.Value = %Date;
&L2Row.K_OFFNSV_REC_EX.EFF_STATUS.Value = &L1Row.K_OFFNSV_REC.EFF_STATUS.Value;
End-For;
End-If;
A suggestion, change/set values on SavePreChange. SaveEdit should be use for validations only.
With that being said:
Your currentrownumber returns the current row, so probably it is returning the row #2 on the level #2.
You need CurrentRowNumber(1) to get the #1 level.
Also, why are you setting the EFFDT yourself on the save? Look at other peoplesoft pages, you will see it is populated on the add by PS itself.

How to see .w trigger is working for my query?

Just for the knowledge I just want to see how WRITE triggers execute for the query below. Is it possible to see them?.
FOR EACH Customer EXCLUSIVE-LOCK WHERE NAME = "Go Fishing Ltd":
ASSIGN Customer.Balance = 600.
END.
Add:
-clientlog path/to/log.log -logginglevel 4 -logentrytypes 4GLTrace
to your startup command.
This will create a log of all of the calls that your code makes.
For more information: https://knowledgebase.progress.com/articles/Knowledge/P9893
You can also use the LOG-MANAGER system handle within your code to dynamically control the logging at runtime:
https://docs.progress.com/bundle/openedge-abl-troubleshoot-applications/page/LOG-MANAGER-system-handle-attributes-and-methods.html
but for simple purposes like this it is easier to just add the startup parameters.
Watch the log-manager show the write trigger being executed on the sports2020 database:
def var clog as char no-undo.
def var lclog as longchar no-undo.
assign
clog = guid + '.log'.
log-manager:logfile-name = clog
log-manager:log-entry-types = '4gltrace:5,4glmessages'
.
for each Customer exclusive-lock where name = 'Go Fishing Ltd':
Customer.Balance = Customer.Balance + 1. // write trigger only fires when record changes
end.
log-manager:close-log().
copy-lob from file clog to lclog.
message string( lclog ).
https://abldojo.services.progress.com/?shareId=62978a833fb02369b25479f0
Relevant snippet from the output:
4GLTRACE Return from Main Block "Customer Customer" [sports2020trgs/wrcust.p]

Losing some z3c relation data on restart

I have the following code which is meant to programmatically assign relation values to a custom content type.
publications = # some data
catalog = getToolByName(context, 'portal_catalog')
for pub in publications:
if pub['custom_id']:
results = catalog(custom_id=pub['custom_id'])
if len(results) == 1:
obj = results[0].getObject()
measures = []
for m in pub['measure']:
if m in context.objectIds():
m_id = intids.getId(context[m])
relation = RelationValue(m_id)
measures.append(relation)
obj.measures = measures
obj.reindexObject()
notify(ObjectModifiedEvent(obj))
Snippet of schema for custom content type
measures = RelationList(
title=_(u'Measure(s)'),
required=False,
value_type=RelationChoice(title=_(u'Measure'),
source=ObjPathSourceBinder(object_provides='foo.bar.interfaces.measure.IMeasure')),
)
When I run my script everything looks good. The problem is when my template for the custom content tries to call "pub/from_object/absolute_url" the value is blank - only after a restart. Interestingly, I can get other attributes of pub/from_object after a restart, just not it's URL.
from_object retrieves the referencing object from the relation catalog, but doesn't put the object back in its proper Acquisition chain. See http://docs.plone.org/external/plone.app.dexterity/docs/advanced/references.html#back-references for a way to do it that should work.

Enable standard toolbar for ALV grid

I created a screen for displaying ALV output but I am not able to show standard toolbar buttons (save, exit, back, etc.).
Can any one suggest how to enable them?
DATA: it_zztstudent type STANDARD TABLE OF zztstudent,
it_fcat TYPE STANDARD TABLE OF lvc_s_fcat,
i_selected_rows TYPE lvc_t_row,
w_selected_rows type lvc_s_row,
it_modified type STANDARD TABLE OF zztstudent,
lw_modified type zztstudent,
lw_zztstudent type zztstudent,
w_variant TYPE disvariant,
o_docking type REF TO cl_gui_docking_container,
o_grid type ref to cl_gui_alv_grid.
FIELD-SYMBOLS: <fs_fieldcat> type lvc_s_fcat.
tables: zztstudent.
select-OPTIONS: sst_id for zztstudent-st_id.
select * from zztstudent
into table it_zztstudent
where st_id in sst_id.
if sy-subrc NE 0.
message e001(zmsgpr).
ENDIF.
call screen 9000.
module status_9000 OUTPUT.
if o_docking is initial.
set PF-STATUS 'ZSTATUS'.
set titlebar 'ZTITLE'.
"Creating Docking Container and grid
PERFORM create_object.
"filling the fieldcatalog table
PERFORM create_fieldcat.
"Modifying the fieldcatalog table
PERFORM modify_fieldcat.
"Registering edit
PERFORM register_edit.
"displaying the output
PERFORM display_output.
ENDIF.
endmodule.
MODULE user_command_9000 INPUT.
Data: lv_ucomm TYPE sy-ucomm.
lv_ucomm = sy-ucomm.
CASE lv_ucomm.
WHEN 'CANCEL' oR 'EXIT'.
PERFORM free_objects.
leave program.
WHEN 'BACK'.
PERFORM free_objects.
SET SCREEN '0'.
leave SCREEN.
WHEN 'SAVE'.
PERFORM save_database.
CALL METHOD o_grid->refresh_table_display.
ENDCASE.
ENDMODULE.
Form create_object.
"create docking container
create object o_docking
exporting
ratio = '95'.
if sy-subrc eq 0.
"create grid
create OBJECT o_grid
exporting
i_parent = o_docking.
endif.
ENDFORM.
FORM create_fieldcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'ZZTSTUDENT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
CT_FIELDCAT = IT_FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
"making the column as editable
FORM modify_fieldcat.
loop at it_fcat ASSIGNING <fs_fieldcat>.
CASE <fs_fieldcat>-fieldname.
WHEN 'ST_NAME'.
<fs_fieldcat>-edit = 'X'.
WHEN 'ST_CITY'.
<fs_fieldcat>-edit = 'X'.
ENDCASE.
ENDLOOP.
ENDFORM.
FORM register_edit.
call METHOD o_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDFORM.
FORM display_output.
w_variant-report = sy-repid.
call METHOD o_grid->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = 'A'
CHANGING
it_outtab = it_zztstudent
IT_FIELDCATALOG = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
if sy-subrc <> 0.
message e001(zmsgpr).
endif.
ENDFORM.
FORM free_objects.
call method o_grid->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
message e001(zmsgpr).
endif.
call method o_docking->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
message e001(zmsgpr).
endif.
ENDFORM.
First double click on set PF-STATUS 'ZSTATUS' on ZSTATUS and create object.
After that you will get here:
Click in functions Keys and add what code you want for each button.
Finally in a case statement, check if sy-ucomm has the value of the code you entered.
First you must create a method, in your class definition like this:
METHODS on_toolbar
FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING e_object.
After that you must create an event object and there you must set the handler for the alvgrid object, like these:
IF gcl_container IS INITIAL.
CREATE OBJECT gcl_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT gcl_grid
EXPORTING
i_parent = gcl_container.
"erstellt einen Handler der alle ereignisse aufnimmt
"created object and set a handler of all events
CREATE OBJECT gcl_event.
SET HANDLER gcl_event->on_toolbar
FOR gcl_grid.
ENDIF.
Hope it helps you. :)

Asp.Net SqlDataReader value magically turns into null on attempt to access and use it

I have an sql command that depends on the results of other sql commands. There are five sql commands in this chain, but the problem occurs in the 4th.
The 5th command must save data to the archive table. When it has to run and take the completion_date value from the 4th command, it throws a null reference exception. Actually it says, that Reader4[0] can't be read because it has null value. That's wrong because it has value, because in the database these queries work fine and also because the condition if (Reader4.HasRows == true) is true, it means that WHERE statement is true in the 4th command, which also includes checking the completion_date! What's wrong with this asp.net?
Command4 = new SqlCommand("SELECT trade_date FROM Schedule WHERE traider_id=#traiderID AND good_id=#goodID AND position_id=#positionID AND status_id=1 AND completion_date IS NOT NULL", Connection4); //note the completion_date check
Command4.Parameters.Add("#traiderID", Convert.ToInt32(Reader3[0]));
Command4.Parameters.Add("#positionID", CurrentPosition);
Command4.Parameters.Add("#goodID", Convert.ToInt32(Reader1[0]));
Reader4 = Command4.ExecuteReader();
if (Reader4.HasRows == true) //this check is done successfully
{
Command5 = new SqlCommand("INSERT INTO Archive (traider_id, good_id, completion_date) VALUES (#traiderID, #goodID, #completionDate)", Connection5);
Command5.Parameters.Add("#traiderID", Convert.ToInt32(Reader3[0]));
Command5.Parameters.Add("#goodID", Convert.ToInt32(Reader1[0]));
Command5.Parameters.Add("#completionDate", Convert.ToDateTime(Reader4[0])); //Here is the problem
Command5.ExecuteNonQuery();
}
Reader4.Close();
Where are you startin to read from the reader?
i.e. where do you call
Reader4.Read();
after
Reader4 = Command4.ExecuteReader();

Resources