I am using Tridion R5.3. I am trying to delete a component in but it it showing as published. No matter what I do I cannot get it to unpublish. I ran the following query against the database to determine where the component is published.
SELECT *
FROM [dbo].[PUBLISH_STATES] WITH (NOLOCK)
WHERE REFERENCE_ID = 268494
And I received the following information
ID : 45173
REFERENCE_ID : 268494
ITEM_TYPE : 16
PUBLICATION_ID : 4
STATE : 1
STATE_CHANGE_DATE : 2006-08-18 12:50:25.597
PUBLICATION_TARGET_ID : 2
TRUSTEE_ID : 43
TEMPLATE_REFERENCE_ID : 89798
TEMPLATE_ITEM_TYPE : 32
I have tried to unpublish the component from the publication target with an ID of 2 but no luck.
Would I be safe to just delete the row in the database?
Update
On the suggestion of Nuno and after reading another question I figure I have to un-publish the associated component template. I have tried the following and I am getting a Type Mismatch when executing the SetPublishedTo() method.
TDS.TDSE tdse = new TDS.TDSE();
var componentTemplate = (TDS.ComponentTemplate)tdse.GetObject("tcm:4-89798-32", TDSDefines.EnumOpenMode.OpenModeView);
componentTemplate.SetPublishedTo("tcm:4-268494", "tcm:0-2-65537", false, tdse.User);
After contacting SDL Support the solution was to set the STATE field to 0 in both the ITEM_STATES and PUBLISH_STATES tables for the relevant component.
UPDATE dbo.ITEM_STATES
SET STATE = 0
WHERE ITEM_REFERENCE_ID = 268494
UPDATE dbo.PUBLISH_STATES
SET STATE = 0
WHERE REFERENCE_ID = 268494
Related
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.
I am processing 1k record however I get system violation error after 800 record. Could someone please suggest how can this error be resolved?
There are designated methods for using OQL, you should take care to
Use a cursor variable
Declare a size that makes sense for your query
Open the cursor (allocates memory)
Close the cursor (disposes memory)
procedure ShowMoviesInCategory(theCategory : tCategory)
var Curs : aOQLCursor
var curMovie : aMovie
Curs = Motor.OpenOQLCursor
Curs.BatchSize = 50
OQL select * from x in aMovie++ where x.Category = theCategory using Curs
forEach curMovie in Curs
WriteLn(curMovie)
endFor
Motor.CloseOQLCursor(Curs)
endProc
Please also refer to the eWAM Help under OQL and
wTECH 101 (week1 - day 5 "101A - OQL - Search.pptx"
In Wynsure there is a designated variable for this, please refer to the Wynsure Development Rules.docx
After a successful logon information about the user is held in a always open but hidden form.
Within the program there are various dropdowns that I want to filter based on 'txt_security' from the hidden form.
Row Source Example
SELECT tbl_master_ship.master_ship_id, tbl_master_ship.admin_only
FROM tbl_master_ship;
Example of data is there are 5 total ships, only one is admin_only. If txt_security = 1 then show all 5 ships else hide the one record marked admin_only.
I tried this but it only shows the one record if txt_security = 1.
WHERE (((tbl_master_ship.admin_only)=IIf([forms]![frm_global_variables]![txt_security]=0,True,False)))
This should be the easiest way:
WHERE [Forms]![frm_global_variables]![txt_security] = 1
OR tbl_master_ship.admin_only = 0
Only if [txt_security] <> 1 AND admin_only = True will the record not be shown.
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.
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. :)