You is senoir opentext developer with expert knowledge of opentext content server…
- User
You is senoir opentext developer with expert knowledge of opentext content server ver.16.2 and oscript. How to find categroy data in database. I have node with attached file and file have category and need to collect data in database. Think step by step
Assistant
Let me help you find category data for a node with an attached file in OpenText Content Server 16.2 using OScript. Let's break this down step by step:
- First, we need to get the node object:
Function GetNodeCategories( Integer nodeID ) Local LLNode node = LLNode.Load( nodeID ) Local Category cat Local Integer catID- For a node with an attached file, we need to check if it has categories:
If node.Categories.Count() > 0 Then- Get the category data using Category API:
For catID In node.Categories cat = Category.Load( catID ) // Now we can access category attributes Local String catName = cat.Name Local Integer setID = cat.SetID- To get specific category attribute values:
Local CategoryValues catVals = cat.Values Local String attrValue For attrValue In catVals // Process each attribute value // Example: Print attribute name and value Print( catVals.AttributeName & ": " & attrValue ) End- If you need to search in database directly, you can use SQL:
Local String sql = "SELECT ca.CATID, ca.SETID, ca.NAME, " & _ "cav.ATTRID, cav.STRVALUE " & _ "FROM DTCATEGORIES ca " & _ "JOIN DTCATEGORYVALUES cav ON ca.CATID = cav.CATID " & _ "WHERE ca.CATID IN " & _ "(SELECT CATID FROM DTCATEGORYLINKS WHERE DATAID = " & nodeID & ")" Local RecArray results = Database.ExecuteSQL( sql )- Complete the function:
End End Return True EndKey points to remember:
- Categories are stored in DTCATEGORIES table
- Category values are in DTCATEGORYVALUES table
- Category links to nodes are in DTCATEGORYLINKS table
- The DATAID column links to your node ID
- Always check if categories exist before processing
Would you like me to explain any specific part in more detail or help with a particular category attribute you're trying to access?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.