Maximo List Archive

This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.



Re: [MAXIMO List] Refreshing record screen on update of child records

From: mattmaxdef (2013-01-31 03:44)

Hi Chris,
Yeah that's how I initially read it as well. I've tried putting the relationship name in instead of the table ID it causes a null pointer error.
Cheers.
--- In MAXIMO@yahoogroups.com, Chris Lawless wrote:
>
> I'm no expert but I read it as you need to specify the relationship that the table is using in place of my_table_id
>
> On Jan 30, 2013, at 10:02 PM, "mattmaxdef" wrote:
>
> > Hi Chris,
> >
> > Yes it does seem like that guy is trying to achieve what I want, however I've tried his code and it doesn't work. I used my table control ID where he has 'my_table_id'.
> >
> > Problem is, I'm not sure what he means by "you need to use the same relationship used by table-control". Any ideas on what he changed in the code?
> >
> > Thanks!
> >
> > --- In MAXIMO@yahoogroups.com, Chris Lawless wrote:
> > >
> > > Much clearer now, thanks, does this help?
> > > http://www.ibm.com/developerworks/forums/message.jspa?messageID=14786194
> > >
> > >
> > > On Wed, Jan 30, 2013 at 6:14 PM, mattmaxdef wrote:
> > >
> > > > **
> > > >
> > > >
> > > > Hi Chris,
> > > >
> > > > I'm sorry if I'm not explaining it very well!
> > > >
> > > >
> > > > > Are you displaying the related assets in application X in a table?
> > > >
> > > > Yes, the X application shows the related assets. OK, so let's imagine X
> > > > table has the attributes:
> > > >
> > > > XID - Unique identifier
> > > > NAME
> > > > DESCRIPTION
> > > > (Other attributes)
> > > >
> > > > ASSET Table has been modified by adding a new attribute 'XID'.
> > > >
> > > > On 'X' table a new relationship is added:
> > > >
> > > > Relationship: XASSETS
> > > > Child Table: ASSET
> > > > Where: XID = :XID and SITEID = :SITEID
> > > >
> > > > On the application for X, a table control is added:
> > > >
> > > > Label: Related Assets
> > > > Relationship: XASSETS
> > > >
> > > > So now the X application shows all the related assets to a record of X.
> > > > That is, where the ID of X (XID) equals the XID column in the ASSET table.
> > > >
> > > >
> > > > > Do you modify the asset in the Assets module or are you looking to do
> > > > the modification from within application X?
> > > >
> > > > I'm looking to the modification from within the application X. This is now
> > > > being done through a Java bean.
> > > >
> > > > > Can you describe what you have in application X in regard to the assets
> > > > and how you are wanting the UI to work?
> > > >
> > > > -- The following is what is working now --
> > > >
> > > > There is a button below the table control I created in the X application
> > > > called 'associate assets'. It fires an event that launches a custom dialog.
> > > > This dialog shows a table of assets (MBO=ASSET). This table has checkboxes
> > > > for each row so the user can select one or more asset. The dialog has a
> > > > button called 'OK'.
> > > >
> > > > The OK button runs a method in the custom java bean called
> > > > 'associateAssets'. This method scans through that table, picks out the rows
> > > > that are checked, and builds an MboSet of all the assets selected by the
> > > > user. The java code then cycles through those ASSET MBOs and modifies the
> > > > 'XID' field, setting it to the ID of the current X record being displayed
> > > > in the X application.
> > > >
> > > > These assets are now 'associated' with that X record. And if I exit the
> > > > application and go back to the record, the table I created in the X
> > > > application will show the appropriate assets related.
> > > >
> > > > -- What I can't get working --
> > > >
> > > > When the user presses OK and the java bean updates the asset records, the
> > > > dialog then closes. However the table control in the application does not
> > > > refresh to show the updates the bean has made to the ASSET records. So the
> > > > assets that the user has selected in the dialog do not show up in this
> > > > table.
> > > >
> > > > It is important to note: The database HAS changed, the assets have been
> > > > modified in the the database at this point. If I exit from this
> > > > application, go back into the application and select the same record, the
> > > > table looks as it should (i.e. those asset records user has selected now
> > > > appear in that table control).
> > > >
> > > > I need a way to 'reload' this table control in the java bean once it has
> > > > made the changes to the asset table. I need to tell it 'go and re-execute
> > > > that relationship'. That is, clear the table, find all assets where XID =
> > > > :XID as through the XASSETS relationship.
> > > >
> > > > This will (in my totally uninformed opinion) probably be a call to a
> > > > method in the java bean, right before or after the dialog closes. Something
> > > > like:
> > > >
> > > > refreshTable();
> > > >
> > > > This is a method available, but it doesn't do anything.
> > > >
> > > >
> > > > > If the expectation is that while one user is viewing a record in
> > > > application X another user relates an asset to that record then the first
> > > > user's session will have no awareness of this without a user initiated
> > > > refresh.
> > > >
> > > > No, we I'm only talking about one user here. Once he/she launches the
> > > > dialog, associates the assets, the table needs to refresh in the X
> > > > application to reflect the changes the java bean has performed.
> > > >
> > > > I hope that explains it better!
> > > >
> > > >
> > > > --- In MAXIMO@yahoogroups.com, Chris Lawless wrote:
> > > > >
> > > > > I don't know if others are clear but I'm not sure I fully understand what
> > > > > you are expecting to see refresh and when. As I interpret this you have a
> > > > > reference on ASSET that indicates that it is linked to a record in
> > > > > application X - lets say LOCATIONS for sake of argument. Are you
> > > > displaying
> > > > > the related assets in application X in a table? If so how is the
> > > > > relationship created, do you modify the asset in the Assets module or are
> > > > > you looking to do the modification from within application X?
> > > > >
> > > > > If you are doing it in application X then how...? Without an intermediate
> > > > > relationship you cannot create a link without modifying an asset from
> > > > > within X which would be complicated unless you are using an action or
> > > > > similar. Can you describe what you have in application X in regard to the
> > > > > assets and how you are wanting the UI to work?
> > > > >
> > > > > If the expectation is that while one user is viewing a record in
> > > > > application X another user relates an asset to that record then the first
> > > > > user's session will have no awareness of this without a user initiated
> > > > > refresh.
> > > > >
> > > > > Chris.
> > > > >
> > > > > On Tue, Jan 29, 2013 at 6:17 PM, mattmaxdef wrote:
> > > > >
> > > > > > **
> > > >
> > > > > >
> > > > > >
> > > > > > Hi Chris,
> > > > > >
> > > > > > Thanks for your reply.
> > > > > >
> > > > > > Yeah it is a one-to-many cardinality, so many assets to one 'X' object.
> > > > > > This means I shouldn't need a mapping table - I just created a field
> > > > in the
> > > > > > ASSET table that that is a foreign key to the primary key of the 'X'
> > > > > > object. This all works fine through the application. There is no
> > > > deleting
> > > > > > or adding of ASSETS in the process, all it is doing is setting this ID
> > > > > > field in the ASSET table to relate the asset to the 'X' object. So the
> > > > > > application either sets it to the ID of X to relate it, or sets it to
> > > > NULL
> > > > > > to un-relate it.
> > > > > >
> > > > > > The actual modification of the database data works all fine. The only
> > > > > > thing I can't do is get the application to refresh after I've made the
> > > > > > database changes. When I'm talking about 'refreshing a table' in this
> > > > case
> > > > > > I mean an application control - not a database table. The application
> > > > > > control needs to refresh to reflect the changes the application has
> > > > made to
> > > > > > the database - i.e. unrelating or relating assets to the X object.
> > > > > >
> > > > > > Cheers!
> > > > > >
> > > > > > --- In MAXIMO@yahoogroups.com, "Hanna, Christopher CTR" wrote:
> > > > > > >
> > > > > > > Depending on the cardinality between the two objects, you may need a
> > > > > > breakout table to make this work. I did something very similar with a
> > > > clone
> > > > > > of lease contracts for locations instead of assets. The breakout table
> > > > > > simply contains the keys of the two objects to be related (absolutely
> > > > > > necessary to implement a many to many relationship), so in the
> > > > application,
> > > > > > you simply create or delete records in the breakout table. This allows
> > > > the
> > > > > > application delete and create to work because you are creating/deleting
> > > > > > records in the breakout table as opposed to creating records in the
> > > > ASSET
> > > > > > object, so it can simply be done through the app.
> > > > > > >
> > > > > > > -Chris H
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On
> > > > Behalf
> > > > > > Of mattmaxdef
> > > > > > > Sent: Monday, January 28, 2013 7:36 PM
> > > > > > > To: MAXIMO@yahoogroups.com
> > > > > > > Subject: Re: [MAXIMO List] Refreshing record screen on update of
> > > > child
> > > > > > records
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Hi Shannon,
> > > > > > >
> > > > > > > Thanks for your reply, it is much appreciated.
> > > > > > >
> > > > > > > Yep, I've created a new table and the custom application bound to
> > > > that
> > > > > > table. I've done it all through the database configurator module and
> > > > > > application designer.
> > > > > > >
> > > > > > > What I'm talking about here is showing a table in that application
> > > > which
> > > > > > I've created, trying to show a list of related records to that new
> > > > custom
> > > > > > table. In this case it's the ASSET table, since one or more assets are
> > > > > > related to a record in this custom table.
> > > > > > >
> > > > > > > So it's easy to show the records via a relationship I've set up in
> > > > the
> > > > > > database configurator, but I want the user to be able to relate more
> > > > assets
> > > > > > and remove the relationship.
> > > > > > >
> > > > > > > Sorry if I've misinterperated your reply.
> > > > > > >
> > > > > > > Cheers!
> > > > > > >
> > > > > > > --- In MAXIMO@yahoogroups.com , "Incomm Solutions Inc." wrote:
> > > > > > > >
> > > > > > > > You actually don't need to do this with Java . just go into
> > > > DBConfig
> > > > > > > > and create a new table to hold the data you want, then go into
> > > > > > > > Application Designer and create a new custom application that's
> > > > bound
> > > > > > to the table.
> > > > > > > > See the section on "Creating an Application" in the Application
> > > > > > > > Developer's Guide for more info.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Note: it's definitely recommended that you do it using the Maximo
> > > > > > > > internal tools, since that makes it visible to the Maximo upgrade
> > > > > > > > tools and other functions in Maximo. Likewise I strongly recommend
> > > > > > > > against adding new tables and/or new indexes outside of the
> > > > Database
> > > > > > > > Configuration application
> > > > > > > > - it makes life difficult down the line, since Maximo is not aware
> > > > of
> > > > > > > > the changes.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Shannon Rotz
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > From: MAXIMO@yahoogroups.com
> > > > > > > > [mailto:MAXIMO@yahoogroups.com ] On
> > > > > > > > Behalf Of mattmaxdef
> > > > > > > > Sent: January-27-13 10:33 PM
> > > > > > > > To: MAXIMO@yahoogroups.com
> > > > > > > > Subject: [MAXIMO List] Refreshing record screen on update of child
> > > > > > > > records
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > OK, I've only been working with MAXIMO for 2 weeks so you'll have
> > > > to
> > > > > > > > bear with me if I'm using terms wrong etc. Sorry in advance.
> > > > > > > >
> > > > > > > > Customer wants a new MBO called X, where the ASSET table has a
> > > > child
> > > > > > > > relationship to X by having the column XID. XID is the ID of the X
> > > > > > table.
> > > > > > > >
> > > > > > > > The desired outcome is very similar to a CONTRACT in MAXIMO having
> > > > > > > > associated assets.
> > > > > > > >
> > > > > > > > Everything is setup in a custom application where users can modify
> > > > X's
> > > > > > > > fields etc. It has a table that shows all assets that are related
> > > > to
> > > > > > > > the record through the relationship.
> > > > > > > >
> > > > > > > > I wanted the ability to associate or disassociate the assets to X
> > > > from
> > > > > > > > this application. So I added a button that launches a dialog,
> > > > showing
> > > > > > > > table of all the assets and they can check the desired assets and
> > > > the
> > > > > > > > application java code will set XID on the selected asset records to
> > > > > > > > the ID of the X record.
> > > > > > > >
> > > > > > > > Similarly a button on the X application allows users to select
> > > > > > > > associated assets from the table and the java code upon pressing
> > > > the
> > > > > > 'disassociate'
> > > > > > > > button will set XID on the selected assets to NULL.
> > > > > > > >
> > > > > > > > This all works fine, except for the life of me I cant get the
> > > > > > > > application to refresh the table that shows the assets associated
> > > > to
> > > > > > > > X. So even when a user associates or disassociates assets, the
> > > > table
> > > > > > > > remains the same. However if you exit from that record and go back
> > > > > > into it, you can see the changes made.
> > > > > > > >
> > > > > > > > I've tried calling the following methods at the end of each
> > > > function:
> > > > > > > >
> > > > > > > > fireDataChangeEvent();
> > > > > > > > fireChildChangedEvent();
> > > > > > > > fireStructureChangedEvent();
> > > > > > > > refreshTable();
> > > > > > > >
> > > > > > > > None of them seem to do what is desired.
> > > > > > > >
> > > > > > > > Has anyone got any ideas? Thanks in advance!
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
>
>
>
>