Wednesday, 27 September 2023

Uninstall MAS SNO from AWS cloud

 

To install SNO instance please refer the IBM provided link below.

https://ibm-mas-manage.github.io/sno/

 

The below topic helps us understand, how to uninstall SNO that was installed in AWS cloud instance.

The first step is to log into the docker container. The next step is to find the path where the SNO instance was installed. Then navigate to the location installation where the  command is present.

 

Step 1: Log into the Docker container



 



Step 2: Navigate to the Location where the MAS SNO is installed.

The path is given below 

  
  
  /opt/app-root/src/masconfig/sno/config/<Cluster Name>

Copy the path name.





Step 3: Navigate to the location where the uninstall command is present.

  /opt/app-root/src/masconfig/sno/installer/latest-4.10
  


 


Syntax

  ./openshift-install
destroy cluster --dir/opt/app-root/src/masconfig/sno/config/<Cluster Name>
--log-level=debug

The cluster name is the above example is SYDNO.

  ./openshift-install
destroy cluster --dir/opt/app-root/src/masconfig/sno/config/sydno
--log-level=debug

 





By running the above command, the cluster is deleted in AWS cloud. This takes care of all the component deletion in AWS including (VPC, subnets, IAM user and etc).







Friday, 2 September 2022

Maximo Script to Remove HTML Tags Using Regular Expression

 There are times when you need to send long description to external system. But the problem occurs when the Long Description is rich text enabled and contains html tags. Below script uses regular expression to remove the HTML tags.

print ("***********Start of the Script************")
from java.util.regex import Pattern
item_long = mbo.getString("DESCRIPTION_LONGDESCRIPTION")
print (item_long)
match_v1 = Pattern.compile('\\<.*?\\>').matcher(item_long).replaceAll('')
print (match_v1)
print ("************End of the Script**************")

Result

**********Start of the Script************
<div>dasdasd</div><div>sdasd </div><div>asdasd </div><div>asdasdasd </div><div>sdasdas <br /></div><!-- RICH TEXT -->
dasdasdsdasd asdasd asdasdasd sdasdas 
************End of the Script**************

Thursday, 30 June 2022

Maximo Attachment File Size

 Below is the script to calculate the Attachment size in Maximo. The File class is used to get the File details and Length() method is used to capture the size details.

from java.io import File 

path = mbo.getString("DOCLINKS.DOCINFO.URLNAME")
print("The Path Value:",path)
if (path):
	file =  File(path)
	print("The Size of the File in Bytes",file.length())
	print("The Size of the File in MB",file.length()/1024)
	print("The Size of the File in GB",file.length()/(1024 * 1024))
Below is the output captured in the system logs.
[6/30/22 8:01:53:951 EDT] 000000e2 SystemOut     O 30 Jun 2022 08:01:53:951 [INFO] [MXServer] [] ('The Path Value:', u'c:\\DOCLINKS\\ATTACHMENTS\\Maximo-access-via-Published-Service-in-your-local-laptop-browser.docx')
('The Size of the File in Bytes', 543667L)
('The Size of the File in MB', 530L)
('The Size of the File in GB', 0L)

Tuesday, 20 April 2021

Maximo Date Format Conversion Using Automation Scripts

We can convert the normal date format to Maximo date format (yyyy-mm-ddThh:mm:ss.ffffff) using Automation Script.

Script Language: javascript

load("nashorn:mozilla_compat.js");
importPackage(Packages.java.text);

erData.breakData();
var actualDate = erData.getCurrentData("ACTUALDATE");
print("INPUT : " +actualDate);

var inputFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
var outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
var dateParse = inputFormat.parse(actualDate);
var maximoDate = (outputFormat.format(dateParse)).replace(" ", "T") +"+05:30";
print("OUTPUT : " +maximoDate);

erData.setCurrentData("ACTUALDATE", maximoDate);

Output:

INPUT : 4/20/2021 03:30:52 PM
OUTPUT : 2021-04-20T15:30:52+08:00

Monday, 8 March 2021

Maximo Date Manipulation Using Automation Scripts

In this topic, we are going to see how to manipulate Maximo dates using Automation scripts. The different kinds of manipulation are

  1. Adding Number to the date
  2. Subtracting Number to the date
  3. Changing the format of the date
  4. Difference between two dates in days 

In the below examples we are going to use Python scripts in Maximo

  1. Object Launch Point is used
  2. Asset object
  3. The “INSTALLDATE” attribute is modified

  Java Calendar class is used for Date Manipulation.


1.     Adding Number to the date

Current date from MXServer is got and adding number (10) to that date.

print("**************Start of C_TEST ********************")
from java.util import Date
from java.util import Calendar
from psdi.server import MXServer

currentDate = MXServer.getMXServer().getDate()
cal = Calendar.getInstance()
cal.setTime(currentDate)

cal.add(Calendar.DATE, 10) 

print ("After Additional to Current Date ---> ",cal.getTime()) 

mbo.setValue("INSTALLDATE",cal.getTime()) 
print("**************End of C_TEST ********************")

Friday, 31 January 2020

Calling Automation Script from List Tab

There are times where we have a list of filtered value and we would like to perform some action on that filtered data. The best place to filter data is the List tab of the application. But when I have the filtered list, how can we call the logic to be performed on the data.

Step 1: Create an Action Automation Script.
Step 2: Make sure the action has been created
Step 3: Create a Signature Option with the same name as Action Name
Step 4: Make sure the "This is an action that must be invoked by user in the UI" option is checked in the Signature option
Step 5: Attach the signature option in the List tab.
Step 6: Make sure the mxevent and signature option are correctly mapped to button field.

Now the question comes where to attach the button group in the List tab


<table datasrc="results_showlist" id="results_showlist" inputmode="readonly" label="Work Orders" mboname="WORKORDER" selectmode="multiple">
<buttongroup id="1580274294655">
<pushbutton id="1580274294659" label="button 3" mxevent="C_WO" sigoption="C_WO" value="C_WO"/>
</buttongroup>
<tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="results_showlist_tablebody">

Sample Action Automation Script.
print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
print(mbo.getThisMboSet().count())
print("$%%%%%%%%%%%%%%#$@#$@#$@#$@#$@#$@#$@#$@#$@&%^&$%^&$%^&$^&$&")

The total number of work order that was filtered in the List tab was 30.


Log for the automation script is given in the below screen shot.



Now we have the mboset for work order. Using while or for we can loop through the mbo in action automation script.





Tuesday, 26 November 2019

Multiple Data Export for Single Page Application


When we have a single page application and we try to export the data, we are only able to export a single mboset value.

For Example: