Clarity

  • 1.  Read Only Attribute

    Posted Apr 11, 2012 02:17 PM
    Hi,

    I need to create a read only attribute that will display a value depending on the selection of a previous attribute.
    The read only attribute has two values: Critical or Not Critical.

    The attribute of which it depends it's a dynamic lookup with values of criticality.

    Hope someone could bring me any good ideas!

    I appreciate your help!

    Thanks a lot!!
    Flo


  • 2.  RE: Read Only Attribute

    Posted Apr 12, 2012 03:49 AM
    Would a "Calculated attribute" just do this for you?

    You would set the "calculation" for the calulated attribute based on your "main" attribute, and then attach a lookup to the calculated attribute that displays Critical/Non Critical.

    (I use this sort of thing a lot, typically to set a read-only (calculated) RAG field based on a number of other fields)


  • 3.  RE: Read Only Attribute

    Posted Apr 12, 2012 04:31 AM
    That is what came into my mind as well.
    How would you make the calculation if some of the values coming from a dynamic lookup would give "Critical" and the others "Noncritical"

    Martti K.


  • 4.  RE: Read Only Attribute

    Posted Apr 12, 2012 09:58 AM
    Hi Dave,

    I thought about a calculated attribute, but the result is not what I am looking for. Some of the values that comes from the main dyn lookup are criticals and some other are not. I can't find the way to make this distinction on the calculated attribute. I need to also clarify that I don't have lot of practise with calculated attributes so I might be missing some of its advantages.

    My main dyn lookup attribute contains like hundreds of values. I am able to differentiate between criticals or not based on a range, but don't know how to relate this lookup to the 'critical or not critial' one.

    The only idea that came to my mind was to create a custom object and linked both values 'critical value -critical/non critical' and then create a new dyn lookup to call this association, but I really think this is not practical at all and that it might be some other way (easier).

    Thanks a lot for the ideas!!
    Flo


  • 5.  RE: Read Only Attribute

    Posted Apr 12, 2012 10:08 AM
    Have youi considered a Process?

    Martti K.


  • 6.  RE: Read Only Attribute

    Posted Apr 12, 2012 10:32 AM
    Hi Martti! Yes! I considered a process... but thought that it might be some other easier way.
    In the meantime, while I wait for more brand new ideas:grin:, I will play a little with a process -_-

    Thank you!


  • 7.  RE: Read Only Attribute

    Posted Apr 12, 2012 11:34 AM

    fgoya wrote:

    ... but thought that it might be some other easier way.
    ....while I wait for more brand new ideas....
    I have aother technique which I have posted about before ; using "dummy lookups" to display derived data on object pages (and the derivation of the value can be as simple or as complicated as you need it to be).

    ...I'll dig out a link to one of the posts and post it in here...


    EDIT : ok this is what I've said before

    --
    You create a dummy attribute as a lookup - one per "thing" that you want to display - set the attribute to default to "1", apply the default to all existing values and make it enter-once.

    You create the parameterised NSQL lookup, that takes the object id as a parameter and executes some clever SQL (this is where the "anything" comes in) and returns the "anything" as the display text and always returns "1" as the key value.

    (Obviously you need to create the lookup before you create the attribute!)

    Then you can place that attribute onto your general page - the underlying value will always be "1", it will always be read-only (since you have set it enter-once) but the display-value will be dynamically derived based on your clever SQL.

    --

    So in your "financial" example, you could build something that took the resource id and retrieved the relevant details from the DB (since you know where they are) to display on the screen.

    (I've posted about this before somewhere on the boards)

    EDIT : this is where I tried to explain it before (a while ago now :mellow: !!) Dynamic Query Lookup


  • 8.  RE: Read Only Attribute

    Posted Apr 12, 2012 01:50 PM
    Hi Dave!!

    I'm having a very hard time understanding your explanation. I know it is very complete and it seems to be very well explained, but still I'm not getting it, sorry :(

    Let me explain far more my situation: I have 5 dependant lookups. For the first four, I created a custom object where I associated values from lookup1 with values from lookup2. Then for dependant lookup3 I created a new custom object where I associated values from lookup2 with values from lookup3, and the same I did with lookup4.

    Now the only lookup left that I have has only two values: Critical - Not Critical. But I have to associate these with the lookup4, which has more than hundreds of values.


    My questions:

    1. I should first create a parameterised NSQL lookup (I understand a dynamic lookup) that would take the object id as a parameter and would execute sql and returns anything as the display text and always returns 1 as the key value. - I don't understand this. Definitely I got very confused trying to relate this with my situation.


    2. When you say: 'create a dummy attribute as a lookup - one per "thing" that you want to display -' do you mean I need to create a dummy attribute for 'Critical' and another one for 'Not Critical'?


    If I want an NSQL to show any value on a dynamic lookup I need to have this value already on the database, right? I mean, I would only be doing a selection and placing it on a field on the general project properties (for instance)

    My main problem is that I don't have this association already made. I only have the values from the previous lookup, and based on the value selected, Clarity would determine if it is critical or not.

    I tried using a process but I don't know how to set the condition since when I want to select the values from the lookup (lookup4) this one is a dynamic lookup and the list of values is not displayed.

    I'm only trying to avoid to create a custom object just to make the match between hundreds of values with its respective state: critical or not critical. I know a plan B must exist :glare:


    ---------------------
    Nevertheless I'm really interested on your post 2296608

    Since I would really like to set the dependant lookup4 as read only, since it will only have a value matched with the previous selection. Now I have the lookup to display the [--Select--], which is not what I would really expect to be shown. But I don't know how to apply your resolution.


    Thanks a lot for all your observations!!!

    Kind Regards,
    Flo


  • 9.  RE: Read Only Attribute

    Posted Apr 13, 2012 04:13 AM
    I'll see if I can answer those points;

    flogoya wrote:

    I'm having a very hard time understanding your explanation. I know it is very complete and it seems to be very well explained, but still I'm not getting it, sorry :(
    Thats OK, what I'm trying to describe is a bit "weird" and it relies on a couple of disparate things all working together in sync to get the result.

    But the result I am getting is that on an object EDIT page, that I can introduce a READ ONLY (i.e. display only) value on the screen that can be "anything"
    (and when I am saying "anything", I almost mean that, I have used this to display calulated values based on the current object (similar to a calcu;lated attribute
    but where the calculation is much more complecx than we can achieve we the stock calculated attribute method), to dsplay explanative text values containing hyperlinks,
    summary information from related objects). I can easily see how I could even extend the method so that I could call web-services and display completely external
    data on screen ; basically "anything" that you can write a piece of pararameter-driven code to return.

    --

    flogoya wrote:

    Let me explain far more my situation: I have 5 dependant lookups. For the first four, I created a custom object where I associated values from lookup1 with values from lookup2. Then for dependant lookup3 I created a new custom object where I associated values from lookup2 with values from lookup3, and the same I did with lookup4.

    Now the only lookup left that I have has only two values: Critical - Not Critical. But I have to associate these with the lookup4, which has more than hundreds of values.
    OK this is where I am a bit confused by your use-case, are these new "custom objects" just existing to maintain some static data-relationships? Or are they
    actual objects that you are allowing the end-use to maniulate in some way in Clarity? (if the former then I don't see the need to be creating these
    as custom objects).

    flogoya wrote:

    My questions:

    1. I should first create a parameterised NSQL lookup (I understand a dynamic lookup) that would take the object id as a parameter and would execute sql and returns anything as the display text and always returns 1 as the key value. - I don't understand this. Definitely I got very confused trying to relate this with my situation.
    OK what I'm saying here is that my "display only" attribute is built using a lookup ; the actual attribute on the underlying Clarity object ALWAYS contains
    a dummy value of "1", but then we associate the attribute on the object with the parameterised lookup (which takes the object id as the patrameter) and
    then in the NSQL logic in the lookup I can construct my value of "anything" (see above for definition of "anything") based on the object id.

    Why this works is that Clarity sees the attribute (value "1") then goes to the lookup to workout what the "display value" for "1" is - but the NSQL logic
    in th elookup used the parameter object id to determine what that display text should be for THIS object (rather than for "1") and returns that value
    as the matching value for "1" in the lookup.

    flogoya wrote:

    2. When you say: 'create a dummy attribute as a lookup - one per "thing" that you want to display -' do you mean I need to create a dummy attribute for 'Critical' and another one for 'Not Critical'?
    So "NO" thats no what I mean - I mean you need a dummy attribute/parametrised lookup per read-only attribute that you want to display.

    flogoya wrote:

    If I want an NSQL to show any value on a dynamic lookup I need to have this value already on the database, right? I mean, I would onlbe doing a selection and placing it on a field on the general project properties (for instance)
    Not neccessarily (but the value existing somewhere on the database would be a normal usage for the method) - as long as you can programtically construct
    the value in the NSQL based on the parameter object id (or even in a database function that the NSQL uses) then thats all we need.

    flogoya wrote:

    My main problem is that I don't have this association already made. I only have the values from the previous lookup, and based on the value selected, Clarity would determine if it is critical or not.
    The "logic" about whether you value is "Critical" or "Non-Critical" is what I mean by the programtic logic in the statement above - I have no idea
    how YOU would calculate that, but you can just code that calulation (however simple OR complex it may be) into the lookup.

    flogoya wrote:

    I tried using a process but I don't know how to set the condition since when I want to select the values from the lookup (lookup4) this one is a dynamic lookup and the list of values is not displayed.
    The ADVANTAGE a process solution has over my dummy attribute/lookup solution is that the process would actually persist you calulated value on the
    Clarity database, my solution is only ever calulated at display-time in the GUI and on on the Object EDIT screen.

    flogoya wrote:

    I'm only trying to avoid to create a custom object just to make the match between hundreds of values with its respective state: critical or not critical.
    OK, as I say above I'm not really sure that I understand you custom object requirements at all ; if this is not "user data" then you can just "code it".

    :wacko:


  • 10.  RE: Read Only Attribute

    Posted Apr 20, 2012 02:54 PM
    Hi Dave,

    I'm back again :)! and now I'm trying to get your suggestion posted here to work.

    But I must be missing something, because I'm not being succeed.

    LookupA is a dynamic lookup and LookupB is another dynamic lookup depending on A. LoookupB only has one value for each selection of LookupA. It would really nice to be able to set lookupB attribute as 'read only' and to have the value from lookupB associated to lookupA automatically without showing the [--SELECT--] value.

    My query for lookupB is as follows:

    SELECT DISTINCT

    @SELECT:LOOKUP.LOOKUP_CODE:LOOKUP_CODE@,
    @SELECT:LOOKUP.NAME:LOOKUP_NAME@
    FROM niku.odf_ca_osde_map_niv2_valcri MAP, niku.CMN_LOOKUPS_V LOOKUP
    WHERE MAP.osde_valor_critic = LOOKUP.LOOKUP_CODE AND LOOKUP.LOOKUP_TYPE = 'OSDE_LOOKUP_VALOR_CRITIC' AND LOOKUP.LANGUAGE_CODE = @WHERE:PARAM:LANGUAGE@
    AND (@WHERE:PARAM:USER_DEF:STRING:TYPE_CONSTRAIN@ = MAP.osde_nivel2)
    AND @FILTER@
    @BROWSE-ONLY:AND LOOKUP.IS_ACTIVE = 1:BROWSE-ONLY@


    And I use type_constraint parameter associated to attribute osde_nivel2 (which is attribute from lookupA)

    I tried your suggestion editing my query as follows:

    SELECT DISTINCT

    @SELECT:1:DUMMYID@ ,
    @SELECT:LOOKUP.LOOKUP_CODE:LOOKUP_CODE@,
    @SELECT:LOOKUP.NAME:LOOKUP_NAME@
    FROM niku.odf_ca_osde_map_niv2_valcri MAP, niku.CMN_LOOKUPS_V LOOKUP
    WHERE MAP.osde_valor_critic = LOOKUP.LOOKUP_CODE AND LOOKUP.LOOKUP_TYPE = 'OSDE_LOOKUP_VALOR_CRITIC' AND LOOKUP.LANGUAGE_CODE = @WHERE:PARAM:LANGUAGE@
    AND (@WHERE:PARAM:USER_DEF:STRING:TYPE_CONSTRAIN@ = MAP.osde_nivel2)
    AND @FILTER@
    @BROWSE-ONLY:AND LOOKUP.IS_ACTIVE = 1:BROWSE-ONLY@

    but it's not working, I think I have to modify something else but I don't know what :sad

    I appreciate your advice! Thanks a lot!!
    Flo


  • 11.  RE: Read Only Attribute

    Posted Apr 12, 2012 11:28 AM
    Hi! I'm back! I'm not sure if I'm not setting process steps properly, but it's not working.

    When I try to set one of the conditions on the 'start step' I can't pick specific values from the dyn lookup attribute. Am I setting the condition in the correct way?

    What I want is that when the critical value is equal to a group of values I want the process to go to the 'It's Critical' step and that through a GEL script updates the 'Is it Critical?' attribute with : 'It's Critical'.
    If the values belongs to the left group of values then it should show 'It's not Critical' on the attribute 'Is it Critical?'.

    Thanks for any suggestion!!
    Flo