EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB20316: How to get all the ID Attribute Elements for a particular Attribute with Java SDK in MicroStrategy 9.4.1


Community Admin

• Strategy


SUMMARY: It is possible to extract only the ID Attribute elements for a particular attribute even if that attribute form is not configured to be a display form. In the same code the user will need to changes the ID of the Attribute to be retrieved. The following sample code assumes that a connection has already been created.


try {
 WebObjectSource webObjectSource = webIServerSession.getFactory().getObjectSource();
 WebElementSource webElementSource = webIServerSession.getFactory().getElementSourceObject();

 WebAttribute webAttribute = (WebAttribute)webObjectSource.getObject("8D679D4B11D3E4981000E787EC6DE8A4",EnumDSSXMLObjectTypes.DssXmlTypeAttribute,true);

 WebAttributeForms webAttributeForms = webAttribute.getForms();
 WebAttributeForm webAttributeForm = null;
 String attributesXML = "";
 for (int x= 0 ; x < webAttributeForms.size(); x++){
 webAttributeForm = webAttributeForms.get(x);
 if(webAttributeForm.getUseName().equals("ID"))
 attributesXML += "<oi did=\"" + webAttributeForm.getID() + "\"/>";

 }
 attributesXML = "<fct>" + attributesXML + "</fct>";

 webElementSource.setObject(webAttribute); 
 webElementSource.setAttributeFormsXML(attributesXML);
 WebElements webElements = webElementSource.getElements();
 Enumeration enumeration = webElements.elements();
 while(enumeration.hasMoreElements()){
 System.out.println(((WebElement)enumeration.nextElement()).getDisplayName());
 }
 }catch(Exception e){
 e.printStackTrace();
 }

 
 
 
Code Customization:
WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build.
 


Comment

0 comments

Details

Knowledge Article

Published:

June 21, 2017

Last Updated:

June 21, 2017