Clarity

Expand all | Collapse all

How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

  • 1.  How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Posted Jul 19, 2018 05:26 PM

    How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

     

    I was able to add a  process step  that validates the field and putting it back from 'Closed-Complete' to 'Started' but unable to display a message informing the user that 'Cannot closed Complete a Unapproved project'



  • 2.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Broadcom Employee
    Posted Jul 23, 2018 02:33 AM

    Hi apuiro,

     

    I have an idea to display a message informing the user that 'Cannot closed Complete a Unapproved project'.

     

    For example,

    - Create Large string attribute in project object with Read-Only. You use this field as Message field for end user.

    - Validates the field and putting it back from 'Closed-Complete' to 'Started'.

    - Update Large string column in database directly with 'Cannot closed Complete a Unapproved project' message.

      You can update column by using gel script.

     

    Regards,

    Shoichi



  • 3.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Posted Jul 23, 2018 03:50 AM

    Unfortunately we can not do any data-based validation beyond what we can define in the attribute or field settings (ranges, sizes etc). 

     

    You could use this method ; TIP : How To Put Any Dynamically Generated Value On A Clarity Object to put a data-based message on an object page.

     

    You would still need to reset the data value via a process / GEL script and XOG though (i.e. not an unsupported direct database update)



  • 4.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Posted Jul 24, 2018 11:03 PM
      |   view attached

    Hi Shoichi, Thank you for your inputs. Would you be able to give a sample GEL script to display the error message? On the first place, how do I associate the  validation to the field and then display the error message?

     

    Hi David, Thank you too for the procedure. I'm a newbie with Clarity. Hope you can give me more details on where I will configure the Oracle SQL statements.

     

    I attached here a brief explanation of the requirement with screen print.

    Attachment(s)

    docx
    Field Validation.docx   57 KB 1 version


  • 5.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Broadcom Employee
    Posted Jul 25, 2018 01:08 AM

    Hi apuiro,

     

    I defined error_message attribute(Text) and sun_status attribute (Text) in project object.

    I created sample process as below. It may not match your requirement.

     

    <sample process description>

    If Project Status="Unapproved", it will invoke automatically when project is updated.

    - If sub_status="CLOSE", then set_message step will be invoked and set "Cannot closed Complete a Unapproved

      project" message to error_message attribute.

    - If sub_status!="CLOSE", then set_clear step will be invoked and set "No Warning" message to error_message attribute.

     

    -------- set_message step invokes below custom gel script ------

    <gel:script
    xmlns:core="jelly:core"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:sql="jelly:sql"
    xmlns:util="jelly:util"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <gel:setDataSource dbId="niku"/>
    <sql:update var="v_result">
       update ODF_CA_PROJECT
       set ERROR_MESSAGE = 'Cannot closed Complete a Unapproved project'
       where ID = ${gel_objectInstanceId}
    </sql:update>

    </gel:script>

     

    -------- set_clear step invokes below custom gel script ------

    <gel:script 
    xmlns:core="jelly:core" 
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" 
    xmlns:sql="jelly:sql" 
    xmlns:util="jelly:util" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <gel:setDataSource dbId="niku"/>
    <sql:update var="v_result">
       update ODF_CA_PROJECT 
       set ERROR_MESSAGE = 'No Warning'
       where ID = ${gel_objectInstanceId}
    </sql:update>

    </gel:script>

     

     

    For example, there is project which Status=Unapproved and sub_status=null.  The error_message="No Warning" as default.

    When I set "CLOSE" into sub_status field and click Save button. The sample process is invoked and it updated error_message column in database directly.

    But project properties page still showed "No Warning". Because page is not refreshed automatically.

    After F5 click, page shows below. error_message field is updated.

    I hope it is helpful for your investigation.

     

    Regards,

    Shoichi



  • 6.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Posted Jul 25, 2018 02:45 AM

    Why does this have to be undertaken using a database update in the GEL script, why couldn't it be undertaken using the supported updated via XOG?  Just pointing out the obvious in the supplied GEL script.

     

    Sadly, we are restricted in creating database triggers which could be used to verify this type of data entry, and respond back with appriopirate error message to the user.

     

    An alternative is to have a 'Data Exception' type facility which is run regularly and alerts the 'PMO' of these types of anomolies (after the fact).



  • 7.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Broadcom Employee
    Posted Jul 25, 2018 03:45 AM

    Hi Roland,

     

    Yes, using XOG to update database via process (gel script) is more supported way.

    I wanted to make my sample process simple and also make it understand easily.

    (Invoking XOG from gel script is little bit complicated) 

     

    Also, I defined error_message attribute as Read-Only, so  system action of process cannot set any value into it.

     

    Regards,

    Shoichi 



  • 8.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Posted Aug 08, 2018 05:57 PM

    Hi Shoichi,

    We tried the scripts you provided, it initially displayed the error message and then after further testing it stops executing the process (it seems start option condition no longer satisfied).

    We wanted the following action to take place  after the Closure Error Message is populated with the error message (after pressing Save and Refresh)

     

    1. Reset back the previous value of the project status after it was set to Closed?

    2. Clear the Error Message.

     

    Thanks for your help!

    Antonio



  • 9.  Re: How do I do a field validation and display an error mesage if the value  entered is not valid relative to another field value. (i.e Changing project status to 'Closed Complete' though the project approval flag is 'Unapproved'?

    Broadcom Employee
    Posted Aug 10, 2018 03:49 AM

    Hi apuiro,

     

    I defined sample process as below. I defined conditions on Start Options and Start Step.

    You may need to move conditions from Start Options to Start Step.

     

    Start Option:

    Start Step:

                                  Note: Post conditions including Japanese. The ”プロジェクト" means Project.

     

    Regards,

    Shoichi