March 13, 2012

How to hide a field using conditional expressions

This entry is part of the Conditional Expressions HowTo.

In this little tutorial, I will show how to dynamically hide the Total Cost field in the PR Lines tab of the Purchase Requisitions (PR) application for the PRs that are in status APPR. This is just an example and the same configuration can be used to hide or show any field based on a particular condition.

Define conditional expression

Open Administration - Conditional Expression Manager application. Create the following conditional expression.
  • Condition: PRAPPR
  • Description: Status is APPR
  • Type: EXPRESSION
  • Expression: :status='APPR'
  • Always Evaluate: true


Configure PR application

Open System configuration - Platform Configuration - Applications Designer application and edit the PR application. Select the Total Cost field in the upper right corner of the PR Lines tab and open the properties window. Click on Configure Conditional Properties button (on TPAE 7.5 it is in the Advanced tab) and configure it as follows.

  • Signature Option: READ 
  • Security Group: EVERYONE
  • Condition for Security Group EVERYONE: PRAPPR
  • Property values when condition PRAPPR is true: Property=display - Value=false

Here is how the Conditional Properties properties should look like.


Save the PR application and open the Purchase Requisition application.
Now for all the PRs in APPR status the Total Cost field in the PR Lines tab will be hidden.

32 comments:

  1. Is it possible to do this in older versions of Maximo like 6.2.

    ReplyDelete
  2. Unfortunately the answer is no.
    Maximo following features have been released in Maximo 7.1:
    - Conditional Expression Manager
    - Conditional Option Access
    - Data Restrictions
    - Conditional User Interface

    ReplyDelete
  3. Conditional Expression applied to SRSTATUS domain restrict list when you change SR Status but on the SR list view all of the Statues are visible. This I do not want. Suggestion on how to make the list from the look up be restricted by the conditional expression?

    ReplyDelete
  4. Try to look the 'Conditional lookup' link in the main Conditional Expressions HowTo page.

    ReplyDelete
    Replies
    1. Hi

      Thanks for the information, but the above configuration is not working. The status column is at Parent Object and Total Cost column is at Child Object, guess this could be the reason why the condition expression configuration is not working

      Delete
    2. The procedure works perfectly. I have tested it thoroughly.
      Th total cost field is PR.TOTALCOST so it is on the main object of the application.
      Beware that the total cost field that is hidden is under the 'PR Lines' tab, not the one in the main tab.

      Delete
  5. If I want to hide filed irrespective of any condition. in that case also i need to crate the Condition from Conditional Expression Manager?

    ReplyDelete
    Replies
    1. You do not have to create a condition.

      Navigate to Application designer --> in the list tab, filer to the application (say, WOTRACK).

      Select Add/Modify Signature Option. Create a new row. Give a name say, HIDEWOFIELDS and a desc "Hide work order tracking fields". Uncheck the Visible box. Click on OK

      Navigate to the tab containing the field you want to hide and display the properties. In the signature options box, type in the newly created sig option (HIDEWOFIELDS)

      Delete
  6. Hi I want to make the complete PR read only when it is at a certain Status how do I do this?
    Thanks.

    ReplyDelete
    Replies
    1. You should use Data Restrictions. I haven't yet prepared an article about it.
      Look at this post and make this changes:
      1. Condition should be on the STATUS field.
      2. Data restriction should be READONLY on the PR object

      Delete
  7. Hi Bruno, do you have a list of Property and it's corresponding values for 'Property values when condition xxx is true / false', or can you point me to any existing documentation?

    ReplyDelete
    Replies
    1. Look at the 'Conditional properties' paragraph in the Conditional Expressions HowTo page.
      Regards

      Delete
  8. Hi,

    I Have a list of classifications where some the classificationid starts with CC05. I want to hide a specific field when a classification that starts with CC05 is selected.

    I have created my condition in Conditional Expression Manager (:classificationid like 'CC05%')

    I have followed your listed steps.When testing, the field keeps on hiding whatever the classification selected is(even if it does not start with CC05).

    any suggestions plz??

    ReplyDelete
    Replies
    1. No idea of may be the problem.
      Try to post your issue on developerWorks forum 'Maximo and process automation solutions' with some more details and the community (including me) will be happy to help you).
      http://www.ibm.com/developerworks/forums/forum.jspa?forumID=1119&start=0

      Delete
  9. Hi Bruno, I love the conditional UI...I am trying to hide a table column using conditional UI. I can get the field itself to hide but not it's label. I have tried everything. The "label" property is supposed to work on table columns but it is not working. I am on 7.1.1.6.

    ReplyDelete
    Replies
    1. Conditional Expressions are evaluated on records so the Conditional UI is designed around this concept.
      I think that what you are trying to achieve it's not feasible.
      Let me know if you find a solution.

      Delete
  10. Nice article, Bruno!

    Regarding "Always Evaluate: true" and Reevaluate flag in Conditional Properties dialog...
    I believe that with conditions that are using status those flags should be set to false/no. But I understand that this article is just an example :)

    Can you create an article about those flags? when you should tick it and when not...

    Regards,
    Alexey

    ReplyDelete
    Replies
    1. Thanks for the comment.
      I will try to write something about it...

      Delete
  11. Hi Bruno ,

    I want to make some of field required on selecting specific tab ?
    how can i create condition for this.

    ReplyDelete
  12. Hi,
    I'm using maximo 7.5
    I try to enable/disable section for specific security group. So i created this expression :
    1 = (select 1 from GROUPUSER where USERID = :&PERSONID& and groupname in ( 'GR_1', 'GR_2'))

    My expression is associated with a sigoption and my sigoption is associated to the section.

    When true --> inputmode = default
    When false --> inputmode = readonly
    But they does not work...

    It is rigth to use that sql expression to do this ? Or should i create a specific class to do this ?

    ReplyDelete
    Replies
    1. SQL like yours should work fine.
      I think the problem is with the property 'inputmode'.
      Look here for a list of available properties.

      Delete
    2. Thanks for your answer.
      It seam that the expression 'groupname in ('GR_1', 'GR_2')' was bad.
      I tried groupname = 'GR_1' or groupname = 'GR_2' and it worked fine.
      Weird...

      Delete
  13. Hi Bruno, We are using Maximo 7.5 and I want to avoid deleting a row in wpmaterial based on this for each row:

    If wpmaterial.wpm5 (extra field) != null hide the trash can icon.
    else
    show it

    I tried to do it using automation scripting but the results are not the expected.

    Any sugestion?

    ReplyDelete
    Replies
    1. Even I have a very similar requirement, but I want to do it through the sigoptions.
      I tried with the conditional UI properties like
      visible - true / false
      disabled - true /false
      didnt work. What conditional property should i use?

      Delete
    2. Hi Bruno,
      I want to hide a description column from the list tab of preventive maintenance application for a particular site as a condition, i tried above technique but it didnt work out. So can it be done through customization? Any help will great.
      ~Siddhesh

      Delete
    3. Siddhesh,

      It works correctly for me. I had to use PM.STATUS as a condition because our system uses only a single site. Also, remember that since the field you are trying to hide is on the LIST tab, the actual Description field will not be hidden, but only the data in the Description field will be blank.

      If you pick a field on the MAIN tab to hide using the above method, you can see the whole field disappear. Let us know if you have any questions.

      Delete
  14. Hi Bruno
    Thanks for excellent tutorials.
    I have one question if you don’t mind. I have created a sigop in work order tracking with conditional expression to hide a field if condition is false - :worktype = ‘RO’, however when the condition is true the field does not appear instantly but only when user goes to start centre and returns back to application? Any idea why this is happening? Many thanks in advance.

    ReplyDelete
  15. I would like to hide work types only on the main work order tab based on a security group, but I still want to be able to filter all work type values on the list tab. Is this possible?

    ReplyDelete
  16. If I have two fields( X & Y).
    If Option A is selected then display X and hide Y.
    If Option B is selected then display Y and hide X.

    How can I do this?

    ReplyDelete
  17. I just did this but with a custom sigoption on maximo 7.6 and found a couple things that may help others.

    1. When using a custom sigoption, make sure to grant access to the security group as described here (Step 4): http://www.edatai.com/blog/2015/04/08/how-do-we-make-a-field-read-only-based-on-security-group-by-using-a-signature-option/
    - Additionally I had to set a condition for this grant, i created an additional condition with 1=1 so the group would always have access to the item with the sigoption.
    2. In order for number 1 to take effect YOU MUST SIGN OUT AND SIGN BACK IN. This will reset your user security and allow the grant to take effect. Found this here: http://www-01.ibm.com/support/docview.wss?uid=swg21614122

    I hope that might help

    ReplyDelete