Maximo Open Forum

 View Only

 Maximo Query Builder/Converter

Jump to  Best Answer
  • Administration
  • Assets
  • End User
  • IoT
  • Maximo Application Suite
  • Security
  • Utilities
  • Work Management
Shirley Castaneto's profile image
Shirley Castaneto posted 07-10-2024 14:24

Hello, I would like some help and I hope that I'm speaking the correct Maximo language.

I was wondering if anyone has a Query Builder/Converter tool.  Example: added all our assets, pms, JP's etc. in one field, and another field, the tool would convert it to a Maximo Query where you can paste into maximo's where clause.

Thank You

Jason Uppenborn's profile image
Jason Uppenborn  Best Answer

I threw together this "List to String" web page for myself earlier this year, and I use it almost daily. It sounds like it might be what you're looking for. Paste your list in the top, say what you want to use to prefix, suffix and separate each item in the list, and hit the button. When you hit the button, you your list will get "converted" as you've prescribed and put in the bottom box. You can then copy and paste it into a QBE field or wherever.

I paste the code here with no warranty or support of any sort. Use it at your own risk and pleasure.

Copy the code below into a text file with a .html extension, then open the file in your favorite browser and enjoy. (I use it in Chrome.)

<!DOCTYPE html>
<html>
<head><title>List to String</title></head>
<script language="JavaScript">
function list2Csv() {
    var input = document.getElementById("list").value;
    if (!input) { return; }
    
    var stringPrefix = document.getElementById("itemPrefix").value;
    if (stringPrefix == null) {stringPrefix = "";}
    var stringSuffix = document.getElementById("itemSuffix").value;
    if (stringSuffix == null) {stringSuffix = "";}
    
    var stringSep = document.getElementById("itemSep").value;
    if (stringSep == null) {
        stringSep = "";
    } else if (stringSep == "\\n") {
        // user wants newlines
        stringSep = "\n";
    }
    stringSep = stringSuffix + stringSep + stringPrefix
    
    // dedup thanks: https://stackoverflow.com/a/9229821/5368626
    var listData = [...new Set(input.split("\n").sort())];
    document.getElementById("output").value = stringPrefix + listData.join(stringSep) + stringSuffix;
}
</script>
<body>
<h1>List to (sorted, deduped) String</h1>
<div>
    <label>List</label>
    <br>
    <textarea id="list" cols="80" rows="25" scroll></textarea>
</div>
<div>
    <div style="display: inline">
        <ul>
            <li><label>Prefix: </label><input type="text" id="itemPrefix"/></li>
            <li><label>Suffix: </label><input type="text" id="itemSuffix"/></li>
            <li><label>Separator: </label><input type="text" id="itemSep"/></li>
        </ul>
    </div>
    <div style="display: inline">
        <button default="true" onclick="list2Csv()">List to String</button>
    </div>
</div>
<div>
<label>String (sorted, duplicates removed)</label>
<br>
<textarea id="output" cols="80" rows="25" scroll></textarea>
</div>
</body>
</html>
Christopher Winston's profile image
Christopher Winston

I am not sure about the 'all' option you seek, but I would try the advanced search, which allows you to use the user interface to pick records for your where clause. You can then run the query and edit the clause.

Shirley Castaneto's profile image
Shirley Castaneto

Okay, thank you Christopher :)

Vivek Nagre's profile image
Vivek Nagre

Hi @Shirley Castaneto I just wanna share my analysis i also think and tried to build a app where we can select the attribute and which make the query automatically as there its in IBM TRIRIGA but i am unsuccessful since Maximo where clause only fetch the current object data and we can extend it using the sub query.
Here is my analysis or you can say try 

To Build any app we need a object but the Maximo where clause dialogue box does not contain any object as well attribute (.) 

But in advance search more search field was there you can add n number of attribute from different table using relationship and once you put value in it it will generate the where clause for us

Shirley Castaneto's profile image
Shirley Castaneto

Thank You Vivek, when I worked for a Company one of our team members built a Converter tool, and it was so helpful.  putting in one asset# followed by comma, repeatedly just takes so much time vs where i was able to copy 100 assets put it in the tool and click a button and it built the query (assets, pms, job plan, etc. if he was able to figure it out someone somewhere would be able to assist us, and we can post it on here.  thank you 

Craig Kokay's profile image
Craig Kokay

Hi Shirley

This one has stumped me as I'm not able to even understand what it is you're after, Maximo has an in-built ability to develop a query using either the filter fields on the list tab or from the fields on the advanced search.  In both cases, it will only work on the fields present on that screen.  If you want others, then you have to first add them to the relevant screen.

There is also the QBR;s which can have fields from all related objects for you to query and report on.  I think this is the closet to what you could be looking for,

So, without having been exposed to something that you have had experience with, what is the outcome? 

Shirley Castaneto's profile image
Shirley Castaneto

Thank you so much Jason, this is what i was looking for.  I really appreciate your help