5 Replies Latest reply on Nov 11, 2010 10:31 PM by spilon

    Unit of measure conversion with a Linked Table


      Dear all,




      I am using AF 2.1.


      I am faced with the following problem. I have to retrieve data from a linked table for pressure readings. One column, let's call it Pressure, holds the value and another column, let's call that one UOM, holds the unit of measure.


      The crux of the matter is that not all UOM are equal. Some in Pa, some in bar, some in N/m2.


      I found out that if I define the attribute as Double, and with a UOM of Pa, I can pass in a string: "23 bar" which gets correctly translated to Pascals.


      That's great.


      I then went on and concatenated my two columns and pointed the attribute to that field (in the linked table it is now of type String, but the attribute still is a Double. This gives me the error message: Cannot specify a UOM for the value '23 bar     '. UOMs are not supported for the type 'System.String'. I did a quick check: trimming does not help.


      I think that is not a fair error message, as the attribute still is of the Double type.


      It might be I am heading down the wrong trail altogether.


      Any thoughts will be greatly appreciated.




      Kind regards,









        • Re: Unit of measure conversion with a Linked Table



          In your linked query sql statement, have you tried converting the values to a single canonical UOM for pressure?





          • Re: Unit of measure conversion with a Linked Table

            I did some further investigation.


            At first I thought maybe it's fixed in 2010. And I started a new 2010 database on my 64 bit laptop, and everything worked. Then I took that database and imported it into my failing one Windows 2003 server based installation (so that's from 2010 down to 2.1) and it still worked.


            I thought maybe the order of creation was important, so I added a new attribute to my template, and configured the table lookup reference but still it did not work.


            I have found no differences between linked tables and "manual" ones.


            I do not know how to attach my database export to this post.




            Kind regards,









              • Re: Unit of measure conversion with a Linked Table

                If I understand the problem correctly, this should be possible.  Lets make it simple.  Given a table with two column, string ID and string Pressure.  Also, you have an element with two attributes: EquipmentID and PressureReading.  You would like to configure a tablelookup DataReference that returns the Pressure column into the PressureReading Attribute.


                If so, that table lookup for the PressureReading attribute should be configured like so:

                SELECT Pressure FROM MyPressureTable WHERE ID = @EquipmentID

                As long as the Attribute type is float/double, and the attribute has a UOM of the same class, the data will be brought into the attribute. 

                  • Re: Unit of measure conversion with a Linked Table

                    @Jan: as a side and friendly note, and mostly for future reference, this is more of an end-user/system configuration question, and these are normally handled through our regular technical support team. No offense to Chris and Paul (they're the best!!), but tech support is generally better equipped (and staffed) to answer these kinds of question... they could even help you via a WebEx session, etc.  If you were to develop using the AF SDK, then this forum is definitely your best bet! Just trying to help make the most out of the resources available to you