14 Replies Latest reply: Apr 15, 2016 1:40 PM by Peter Cammaert RSS

    Convert String to Hexadecimal Key

    Wallo Atkinson

      Hi, I'm fairly new to qlik but from what I understand you can generate an integer key on a string by using autogenerate().  The problem as I understand is that using autogenerate() doesn't keep your key consistent necessarily.  For example using autogenerate(Products)  on Table A may not give you the same result as autogenerate(Products) on Table B because of the nature of data on each table.

       

      Assuming I'm correct. (Big assumption) 

      Can I have Qlikview generate a key that will always generate the same exact key based on the string value?  For instance, if my Product is Apples how can I get Qlikview to always generate the same key value regardless of what qvd or table it is in?  I was thinking you could convert the string of "Apples" to hexadecimal or binary and then use that as the key?  Is that viable?  Has anyone done that?  Did you use a code in a module or is there a native qlikview command?

       

      My real life example is this, I have a QVD X that has ToUSDExchangeRate, Trans Currency, Year, Month, Date.  And then I have QVD Y that has RecordID, Trans Currency, Charge, Year, Month, Date. 

      I was thinking I would add hex keys to both QVDs at time of QVD creation that represent the Date and Trans Currency concatenated.  It would enable me to link the 2 QVDs together easily whenever I need to.  I would prefer not linking on concatenated string fields..

       

      Thanks for your thoughts and ideas!