How to access the Maximo list where clause programmatically

牧云@^-^@ 提交于 2019-12-10 17:23:05

问题


In the WOTRACK app of Maximo, I need to find some way to programmatically access the where clause of the current window query. It's clear this exists somewhere in Maximo, since you can access it in the UI under Advanced Search > Where Clause. I need to find some way to get this info programmatically and pass it on to an application I am working with.

In the past I've hacked together a way of grabbing this data by having the user open the where clause window in Maximo, and then just retrieving the value of the textarea element containing the where clause. I'm hoping to find some way to access it through Maximo's Java classes, so the user doesn't have to open that window. I've dug through Maximo's Javadocs and I can see there is a WhereClauseTextArea class which I believe would be responsible for creating the text area. I would like to be able to pass the UI session ID to Maximo's Java classes and get back the current where clause for the list. Is there a simple way of doing this? I would like to be able to use JavaScript to access this from the front end, or Java to access it from the back end of Maximo, or an automation script as a last resort.


回答1:


In Maximo 7.6.1.1/Jython, we can use the getWebClientSession() method:

from psdi.common.context import UIContext

wclause = UIContext.getCurrentContext().getWebClientSession().getCurrentApp() \
    .getResultsBean().getMboSet().getUserAndQbeWhere()

service.error("The WHERE clause is : ", wclause);
  • At the time that this was written, the getWebClientSession() method wasn't included in the docs (because the docs were for version 7609).

  • Credit goes to AndreasBr on DeveloperWorks for finding the original answer: Sending "dialogok" from Automationscript | get WebClientSession in Jython.




回答2:


Maximo has a number of different where clause sources (app restrictions, object restrictions, relationships, QBE (Query By Example) filters, site restrictions, and more). With an Automation Script (Python or JavaScript), you should be able to snag what you're looking for from mbo.getThisMboSet().getUserWhere() or .getUserAndQbeWhere() or .getWhere(). As a commenter pointed out, .getCompleteWhere() may also be helpful.

You can find the JavaDocs on those psdi.mbo.MboSet methods, or find other "where clause getting" methods, here.



来源:https://stackoverflow.com/questions/56706693/how-to-access-the-maximo-list-where-clause-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!