Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Reto_3 Absent Member.
Absent Member.
462 views

Attachment relink

Jump to solution

Attachment relink

 

Hi, I need to link all attachments that are currently linked to Design Steps to the appropriate Test Case on DB Level. So that we have the Attachment still available at the Design Step but also at Testcase level (We have Smart Repository in QC 11.5)

 

What I have done so fare:

 

1. I inserted a new record in Table Smart_Repository_locical_file by creating a new SRLF_ID and adjusting the SRLF_NAME to the appropriate Test Case and Test Case Number. Leaving the physical part as the original.

 

Here my insert SQL:

INSERT INTO [hpalm_db].[td].[SMART_REPOSITORY_LOGICAL_FILE] (SRLF_ID, SRLF_PARENT_PATH, SRLF_NAME, SRLF_PHYSICAL_ID, SRLF_IS_DIRECTORY, SRLF_LAST_MODIFIED, SRLF_SIZE) VALUES ('35324','.\attach\','TEST_14365_docname.docx','10936','N','2011-11-07 14:38:04.000','118288')

 

 

2. Then I update the appropriate record in Table TEST to reflect that it has an Attachment

 

Here my sql:

UPDATE [hpalm _db].[td].[TEST] SET [TS_ATTACHMENT] = 'Y' WHERE [TS_TEST_ID] = 14365

 

But it did not work! I am sure there must be an other table to alter that makes the connection of SmartRepository and TestCases as I doubt that the concatenated SRLF_NAME with the TS_TEST_ID is the only link.

 

But I did not find an other Table that links these entities.

 

Any help?

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Attachment relink

Jump to solution

You will need to update at least the CROS_REF table as well.

 

But if I were you I would not want to update the database this way. You may end up with a corrupt database if things go wrong. I would rather create an OTA API script so you don't have to worry about updating the tables directly and jeopardizing database referential integrity.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
2 Replies
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Attachment relink

Jump to solution

You will need to update at least the CROS_REF table as well.

 

But if I were you I would not want to update the database this way. You may end up with a corrupt database if things go wrong. I would rather create an OTA API script so you don't have to worry about updating the tables directly and jeopardizing database referential integrity.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Highlighted
Reto_3 Absent Member.
Absent Member.

Re: Attachment relink

Jump to solution

Thnanks Jan

 here my insert to Cros Ref Table:

 

INSERT INTO [hpalm_db].[td].[CROS_REF] ([CR_ENTITY],[CR_KEY_1],[CR_REF_ID],[CR_REFERENCE],[CR_REF_TYPE],[CR_REF_SUBTYPE])
  Values ('TEST','14365','46030',' TEST_14365_Docname.docx','File','0')

 

now it works perfectly!

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.