Clarity

Expand all | Collapse all

Convert Lookup -String to Lookup-Number?

Jump to Best Answer
  • 1.  Convert Lookup -String to Lookup-Number?

    Posted 10-09-2015 11:46 AM

    Is there a way to convert a lookup that returns a string (lookup_code hidden key) to a number (lookup_enum hidden key)? We have a few attributes that use different lookups to calculate a score which right now is in a process. I'd like to convert it to a calculated attribute but becuase one of the lookups was created using lookup_code it is not available for use in a calculated attribute. The actual values for the lookup are numbers just like in the other ones but I can't figure out a way to update what they are seen as. I tried xogging the lookup out and changing

    <staticLookup autoSuggestEnabled="true" autoSuggestMaxSuggestions="10" code="ORH_ALIGNCHOICE3" hiddenAttributeName="lookup_code" sortStyle="manual" source="niku.com" status="active" update="true">
    
    

    to

    <staticLookup autoSuggestEnabled="true" autoSuggestMaxSuggestions="10" code="ORH_ALIGNCHOICE3" hiddenAttributeName="lookup_enum" sortStyle="manual" source="niku.com" status="active" update="true">
    
    

    and the values from

    <lookupValue code="1" sortOrder="0" status="active">
    
    

    to

    <lookupValue code="1" enum="1" sortOrder="0" status="active">
    
    

     

    The XOG is successful with no errors, but nothing gets changed.



  • 2.  Re: Convert Lookup -String to Lookup-Number?
    Best Answer

    Posted 10-09-2015 01:55 PM

    It is an 'enter once' field that decides whether the lookup is based on LOOKUP_CODE or LOOKUP_ENUM, so you cannot change it afterward - with some rare (and sometimes necessary due to interface differences) exceptions, the business rules applied to the UI apply to XOG as well.

     

    It also wouldn't be enough in this case to just change the meta data, the way the data is physically stored in the DB is also different (number columns vs. character columns).

     

    Code could be written to manage this of course, so you may wish to raise an Idea for this capability for the future, but there are no ways to do this currently that would retain a supported system state other than to create a new lookup and migrate away from the old one to it.



  • 3.  Re: Convert Lookup -String to Lookup-Number?

    Posted 10-09-2015 02:23 PM

    What if you pushed the lookup_code into one of the expression functions -- say Average(lookup_code, lookup_code)  maybe under the covers it might do a implicit conversion of the string.

     

    Just a guess,

    Gene



  • 4.  Re: Convert Lookup -String to Lookup-Number?

    Posted 10-09-2015 02:35 PM

    No dice, the attribute isn't available for selection, and just typing it in fails validation (it works when clicking Validate "The expression syntax is valid", but when trying to save it gives an error "Invalid expression. Check the format to make sure it is correct")

     

    Nick Darlington wrote:

     

    create a new lookup and migrate away from the old one to it

    Thats what I was afraid of and hoping to avoid, but figured I'd see if anyone had a trick up their sleeves



  • 5.  Re: Convert Lookup -String to Lookup-Number?

    Former Employee
    Posted 10-15-2015 06:32 PM

    Hi Lino - We're you able to make any further progress with this? Thanks, Chris



  • 6.  Re: Convert Lookup -String to Lookup-Number?

    Posted 10-19-2015 10:03 AM

    Sorry for not following up. I'll just be leaving it as a process the way it is for now. Once our upgrade is complete and things have settled I'll go ahead and make a remake the lookup and move everything over but its a pretty low priority since the current system "works", just annoys me