I have a work order in Maximo. The work order application has custom fields:
FieldA
= 'Hello'
FieldB
I want to take the value from FieldA
and pass it to a function in the Oracle database:
CREATE OR REPLACE function hello_world(var1 in varchar2) return varchar2
is
hw varchar2(15);
begin
if var1 = 'Hello' then
hw := var1 || ', World!';
end if;
return hw;
end;
/
And I want FieldB
to display the value that was returned by the function:
FieldB
= hello_world(FieldA)
>>> Hello, World!
How can I do this?
(Version 7.6.1.1; desktop/classic)
I would create an Automation Script with an Attribute Launch Point on FieldA. The script will have to use a reference to the database manager and the user's connection key to connect directly to the database, and then use some standard java.sql calls to create a statement, execute it, and extract the results. Then it would put the results in FieldB.
To do all that, it will help to have the Maximo business objects JavaDocs and the Java 8 JavaDocs on hand, on top of the Automation Scripting help available from within Maximo.
If you need someone to do that coding for you, I suggest hiring a consultant. :-)
And all that said, you should just use the automation script to do what you have the database function doing, if at all possible. To be more blunt, what you are wanting to do is not considered good practice. So, make sure to include in your script's comments your justification for not following good practice.
来源:https://stackoverflow.com/questions/56460154/take-value-from-fielda-send-to-db-function-return-value-to-fieldb