Clarity

Expand all | Collapse all

Can I modify the display value of a virtual attribute?

  • 1.  Can I modify the display value of a virtual attribute?

    Posted Apr 04, 2019 01:03 PM

    I am adding a couple virtual attributes to display data from the master object (project) into a sub-object (status reports). 

     

    The first is a date field and the data is displaying in the sub-object with the time stamp included (only the date format [mm/dd/yyy] displays in the master object) How do I modify the virtual field so that only the date shows in the sub-object.

     

    The second is a field tied to a resource lookup. The master object shows the full name, but the sub-object using the virtual field is display the ID tied to the resource. How do I modify the virtual attribute to also display the name.



  • 2.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 04, 2019 03:49 PM

    This is a partial answer. The values come from the database and apparently by default they come as they are stored there.

     

     

    This for the list view only. This is a subobject of the project and the list view.

    In the object properties view field properties there are options for the Date/Time format scale.

    Choose date.

    If you change that to Day it will display date only.

    But you may have to publish the views and the users restore the defaults to get the result.

     

    There are no such options for the fields in the properties view.

    But the display appears to be date only by default.

     

    As far the lookups go I have no answer.The values for such a field for the master object are stored as the codes not values. So creating a virtual attribute from such a field can only pass the code.

    One option to pursue is to create an auxiliary field for the master object which stores the value an not the code. Then create a virtual attribute from that. I have not tried to create such a field. Maybe that can only be done with a process.



  • 3.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 04, 2019 03:59 PM

    I don't have the "Day/Time Format Scale" field available in my version.

     

    On Prem 15.5.0.225 01 19

     



  • 4.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 04, 2019 08:29 PM

    Your last screen shot is from the Attribute on the LAYOUT view - this can't be modified and should only be showing as date.

    If you push the virtual to the LIST view, then you have the option to show date/time.

     

    Is it on the List or Edit view that is displaying the date/time?

    What is the attribute on the Project you have created the virtual field for?  Several PPM clients I have like to have the project start/finish dates on the Status Report edit screens, and these are showing as just dates on the Edit views of the Status Report.

     

    In relation to your question about the look-up display, the look-up needs to be configured to include the Resource Name, and to use this as the Display Attribute.  Have a look at the OOTB lookup Active Resources -  LOOKUP_USER_ACTIVE_SEC

    (which should be read-only and you can't modify this one),navigate to the parent window and you will see the Display Attribute is set to full_name.  What look-up have you used for the sub-object to link to the resource?  If it is a custom look-up, then you should be able to modify it to include the Resource Name and use this as the Display attribute for the lookup.



  • 5.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 09:13 AM
    Edited by Pat Douglas Oct 21, 2019 02:44 PM

    This is the query used for the lookup referenced (which is based on a group).

     

    select
    @select:r.id:user_id@,
    @select:CASE r.last_name||', '||first_name WHEN '-------' THEN '-------' WHEN '--------' THEN '--------'
    WHEN '---------' THEN '-------' WHEN '-------' THEN '--------' WHEN '--------' THEN '--------' ELSE r.last_name||', '||r.first_name END:name@,
    @select:r.unique_name:id@
    from srm_resources r,
    cmn_sec_groups g,
    cmn_sec_user_groups ug
    where G.ID = UG.GROUP_ID
    and ug.user_id=r.user_id
    @BROWSE-ONLY:and g.group_code = 'tda_tech_del_owner':BROWSE-ONLY@
    AND @FILTER@

     

    The "name" field is used as the display attribute - yet the code is still displaying in the virtual attribute.

     

    With the display attribute on the lookup set to that name field, I'd assume the name result should display. Would it make a difference if I added the full_name column into the query and set that as the display attribute? It will still display essentially the same information.



  • 6.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 10:13 AM

    yet the code is still displaying in the virtual attribute

    that is because it is the hidden key that is stored in the db and displayed as the virtual attribute.

     

    To follow that approach the hidden key would have to be r.last_name||', '||first_name

    (full_name is not necessarily always the same and can even be blank in the db)



  • 7.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 10:31 AM

    I created a virtual field on Status Report for the Manager on the Project.  Pushed the virtual field to the Edit screen on the Status Report and the PM's name appeared, not the value stored on the database.This was using V15.5.  please repeat in your environment to see what happens using an OOTB lookup.



  • 8.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 10:53 AM

    Your query will be returning more than 1 row, when the resource belongs to one group, this may be causing PPM to not know what to show, so it is displaying the value on the database.  Or, something similar.

     

    Personally, I would be wrapping @browse tags around the group tables, you will need to modify the query to use joins to achieve this.  Like

    @browse...

    Join cmn_sec_groups g ...

    .... = 'tda_tech_del_owner':BROWSE-ONLY@

     

    This way the lookup will always return a value for the Resource regardless if the resource belongs to multiple groups, or, no longer belongs to that group., When updating the attribute, it will still use the browse tags to only show resources in that group.  This is just a guess as the OOTB lookup worked for me to display the PM's name on a virtual attribute on the Status Report.



  • 9.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 10:01 AM

    Virtual attributes display the underlying value you would see in the database which is why you see the key value and not the display value on the sub-object.  You can work around by creating an attribute with a parameterized lookup which can pull the display value for the attribute from the parent instance.



  • 10.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 10:53 AM

    How would I tie back to the parent project for the status report within the lookup query?

     

    select
    @select:r.full_name:full_name@,
    @select:r.id:user_id@,
    @select:r.unique_name:id@
    from srm_resources r,
    odf_ca_inv o,
    inv_investments i,
    odf_ca_tda_status_reports s
    where o.tda_tech_del_owner = r.ID
    and i.id = o.id
    and s.odf_parent_id = id
    AND @FILTER@



  • 11.  Re: Can I modify the display value of a virtual attribute?
    Best Answer

    Posted Apr 05, 2019 11:07 AM

    You already are tying back to the parent instances in your where clause by joining inv_investments and odf_ca_tda_status reports with s.odf_parent_id = i.id.  You still need to add the NSQL parameter tag, though, to capture the child object instance.  You can reference this post with directions on how to add the parameter and set up the attribute.



  • 12.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 08, 2019 01:11 PM

    OK

     

    I think I got the query right for the lookup:

     

    SELECT
    @select:r.unique_name:user_id@,
    @select:r.full_name:full_name@
    from srm_resources r,
    odf_ca_inv o,
    inv_investments i,
    odf_ca_tda_status_update s
    WHERE o.tda_tech_del_owner = r.id
    AND i.id = o.id
    AND s.odf_parent_id = i.id
    AND s.id = @WHERE:PARAM:USER_DEF:INTEGER:ID@
    AND @FILTER@

     

    It is returning the info it should, but it is not automatically filling it in.

     

    I'm at a loss. I also want to make it read only, but it won't let me select null as the default.



  • 13.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 08, 2019 03:08 PM

    Nevermind ttinley - I figured it out.



  • 14.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 05, 2019 11:08 AM

    Like this?

     

    select
    @select:r.full_name:full_name@,
    @select:r.id:user_id@,
    @select:r.unique_name:id@,
    @select:s.id:odf_parent_id:parent_id@,
    @select:i.code:project@
    from srm_resources r,
    odf_ca_inv o,
    inv_investments i,
    odf_ca_tda_status_reports s
    where o.tda_tech_del_owner = r.ID
    and i.id = o.id
    and s.odf_parent_id = id
    AND @FILTER@
    AND @WHERE:PARAM:USER_DEF:STRING:parent_id@ = project



  • 15.  Re: Can I modify the display value of a virtual attribute?

    Posted Apr 08, 2019 09:52 PM

    PatDouglas82324515, though this is one solution, will you be investigating why your custom look-up is not working?  I believe it is wrong and needs to be corrected.  Please see my feedback from last week.

     

    Your current SQL will return multiple rows for the look-up when in non-browse mode (aka when decoding the value to display on the screen), which may cause issues when the Resource is allocated to multiple groups, or is unable to decode the value if the Resource is removed from all Groups.  PPM may handle the first case, but it will not be able to handle the second case.