BusinessObjects Board

Modify unx objects using SL SDK?

Hello All.

I’m trying to update BO unx objects using Java SL SDK. after going through the documentation & forums i was able to get some information to add objects to universe using the code. For my requirement i need to edit the sql code to change the functions and the table names in the objects. can someone please let me know if its possible to modify the UNX object using SDK code?

Thanks a lot in Advance

Thanks,
Krishna


krishnapatel (BOB member since 2019-10-18)

Sure. I’m assuming you’ve gotten as far as retrieving the objects from their parent folders. You’ll need to cast the BIItem down to BusinessObject (or Attribute / Dimension / Measure, as appropriate). Then call BusinessObject.getBinding() to get a Binding object. Cast it to RelationalBinding, and then you can use setSelect() and setWhere().

Untested sketch:


for(BIItem item : folder.getChildren())
{
   if(item instanceof BusinessObject)
   {
      BusinessObject bo = (BusinessObject)bo;
      RelationalBinding binding = (RelationalBinding)bo.getBinding();
      binding.setSelect("new_table.new_field");
   }
}

joepeters :us: (BOB member since 2002-08-29)

Thanks a ton Joepeters,

Sorry, i took sometime to get back to you as i was looking into the code.

your code helped me to modify the objects and publish it back to CMS. With your code i was able to modify the objects in the parent folder. Just had another question. How do we go down to the subfolders to modify the objects. I looked into Javadocs and it has option to bring back parent folder but i do not see an option to go into subfolders… How to go to sub folder to edit an object?

I’m not familiar with the Javascript, please bear with my dumb questions.

Thanks
Krishna


krishnapatel (BOB member since 2019-10-18)

This is Java, not Javascript :slight_smile:

Folder is a subinterface of BIItem, as is BusinessObject, so:


for(BIItem item : folder.getChildren())
{
   if(item instanceof BusinessObject)
   {
      BusinessObject bo = (BusinessObject)bo;
      RelationalBinding binding = (RelationalBinding)bo.getBinding();
      binding.setSelect("new_table.new_field");
   }
   else if(item instanceof Folder)
   {
       <<recurse back into method, passing (Folder)item>>
   }
}

joepeters :us: (BOB member since 2002-08-29)

[Moderator Note: Moved from Semantic Layer / Universe Designer to SDK (VBA/ASP/JSP)]


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Thanks Joepeters,

Can you also please guide me on how to retrieve the sql for each dimension and measure in the unx. Basically when you right click on the object we have a option “show query script” to look at the object sql with select and from class. Attached is the screenshot for reference
show sql query.pdf (80.0 KB)


krishnapatel (BOB member since 2019-10-18)