The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic

Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.

If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.

Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.

Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Weights and Measures

  • Filter
  • Time
  • Show
Clear All
new posts

  • Weights and Measures

    Has anyone ever done a site with mixed Metric and standard weights and measures?

    For instance, customer 1 wants lengths to be in inches but weight in kilos.

    Customer 2 operates all in metric

    Customer 3 does temperature in fahrenheit, lengths in cm and weights in oz and lbs.

    Grids and dialogs will have to accommodate choices as will report and even reporting setups. Some reports will even cross customer boundaries so I'll have to calculate inches plus centimeters (converted of course) if the report receiver wants output in inches.

    I certainly have some ideas about what I want and need to do, but thought I'd see if anyone had already dealt with this and has ideas. hints, lessons learned (other than "Don't try this at home"), that sort of thing.

  • #2
    Re: Weights and Measures

    You probably have the same thoughts as me -- if you have a lot of fields and offer complete flexibility for data entry, it gets pretty hairy
    • Record exactly what the user types in rather than a converted value and make that field a floating point
    • a table by customer by field that said what measurement will be used each entry. That same table has to show the Min and Max values for each field, and possibly number of precision points, to be used for data validation. Their selection comes from a lookup to a Measurement table which also includes the symbol to use to indicate that measurement.
    • a little run time Label magic to ensure the field label includes what measurement to use when entering that value
    • validation if possible to ensure what they enter is within an allowed range. E.g. if the lower limit is "freezing" then Celsius=0, Fahrenheit =32 if Kelvin=273.15 and Nords=401.
    • avoid re-calculation. The data-entered values should be stored as typed in, not converted.
    • It would be oh-so-nice if your Conversion table (how to convert F to C) was a web services rather than your own table.
    Last edited by Steve Wood; 04-02-2012, 07:25 AM.
    Steve Wood
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)


    • #3
      Re: Weights and Measures

      Steve - I've found a whole other argument somewhere in googling that suggested all data be stored either in metric or imperial, and you make any necessary conversion on the way in or out.

      For the sake of argument, why not do this? It will especially help with cross-company reporting where I want to find, say, the average weight of a particular widget across companies.

      In my case, we can specify that all volumes are liters, all lengths are inches, all weights are lbs and all temperatures are centigrade. With that in hand, I can use the grids' Server side events to record everything in metric, but allow data entry and data presentation in the measurement of that company's choice. Four session variables and a few small functions should server nicely.

      Again - I haven't detailed this and there might be a really big point that I'm missing but this seems pretty clean to me.

      Further thought: for purposes of integrity I could also keep a field of their original input in case there's any need to verify or audit the conversions.


      • #4
        Re: Weights and Measures

        I'm in the midst of doing that right now. Little different that what you want, but many of the same issues. Here are the fields from my table:
        `VALUE_ANSWER` decimal(11,4) DEFAULT NULL,
        `VALUE_ANSWER_UNITS` varchar(10) DEFAULT NULL,
        `STD_UNITS_METRIC` varchar(10) DEFAULT NULL,
        `STD_DECIMALS_METRIC` tinyint(4) unsigned NOT NULL DEFAULT '0',
        `STD_UNITS_ENGLISH` varchar(10) DEFAULT NULL,
        `STD_DECIMALS_ENGLISH` tinyint(4) unsigned NOT NULL DEFAULT '0',
        `VALUE_ANSWER_STD_ENG` decimal(11,4) DEFAULT NULL,
        `LOWER_LIMIT_METRIC` decimal(11,4) DEFAULT NULL,
        `UPPER_LIMIT_METRIC` decimal(11,4) DEFAULT NULL,
        `LOWER_LIMIT_ENGLISH` decimal(11,4) DEFAULT NULL,
        `UPPER_LIMIT_ENGLISH` decimal(11,4) DEFAULT NULL,

        The most important field is the CONVERSION_FUNCTION_NAME. That tells me if the field is length, temperature, area, volume, pressure and so on. The Value...fields are what the user enters, with the VALUE_ANSWER_UNITS a dropdown of acceptable units, for xample, no feet and inches. The STD_UNITS... are the metric and english units to convert into with upper and lower limits (I just check if the two are diferent, then appliy limits, else ignore) and the decimals tells me how many decimals to display.

        Then, I have a conversion functions for each set of units, for example
        FUNCTION Conv_Length AS C (Answer AS C, AnswerUnits AS C, MetricUnits AS C, MetricDecimals AS N, EnglishUnits AS C, EnglishDecimals AS N )
        dim vAnswer as n
        dim vTmp as n
        dim vMetric as c
        dim vEnglish as c

        vAnswer = Convert_Type(Answer,"N")
        AnswerUnits = lower(AnswerUnits)
        MetricUnits = lower(MetricUnits)
        EnglishUnits = lower(EnglishUnits)

        IF AnswerUnits=="in"
        IF MetricUnits=="mm"
        vTmp=vAnswer * 25.4
        vMetric = alltrim(str(vTmp,10,MetricDecimals))
        ELSE IF MetricUnits=="m"
        vTmp=vAnswer * .0254
        vMetric = alltrim(str(vTmp,10,MetricDecimals))
        END IF
        IF EnglishUnits=="in"
        vEnglish = alltrim(str(vTmp,10,EnglishDecimals))
        ELSE IF EnglishUnits=="ft"
        vTmp=vAnswer / 12
        vEnglish = alltrim(str(vTmp,10,EnglishDecimals))
        END IF
        END IF
        IF AnswerUnits=="ft"
        IF MetricUnits=="mm"
        vTmp=vAnswer * 304.8
        vMetric = alltrim(str(vTmp,10,MetricDecimals))
        ELSE IF MetricUnits=="m"
        END IF

        Conv_Length = vMetric+"|"+vEnglish

        Then in the CanUpdateRecord event is
        ' convert units (limits are checked in field validation)
        vFn = alltrim(DataSubmitted.CONVERSION_FUNCTION_NAME)
        if len(vFn) > 3
        if is_one_of(vFn,vUnitList)
        DataSubmitted.VALUE_ANSWER_STD_ENG = DataSubmitted.VALUE_ANSWER
        DataSubmitted.VALUE_ANSWER_STD_METRIC = DataSubmitted.VALUE_ANSWER
        vAnswer = DataSubmitted.VALUE_ANSWER
        vUnits = DataSubmitted.VALUE_ANSWER_UNITS
        vMU = DataSubmitted.STD_UNITS_METRIC
        vMD = val(DataSubmitted.STD_DECIMALS_METRIC)
        vEU = DataSubmitted.STD_UNITS_ENGLISH
        vED = val(DataSubmitted.STD_DECIMALS_ENGLISH)
        end if
        if vFn = "LENGTHUNITS"
        vValues = Conv_Length(vAnswer,vUnits,vMU,vMD,vEU,vED)
        elseif vFn = "PRESSUREUNITS"
        vValues = Conv_Pressure(vAnswer,vUnits,vMU,vMD,vEU,vED)
        elseif vFn = "TEMPERATUREUNITS"
        vValues = Conv_Temperature(vAnswer,vUnits,vMD,vED)
        end if
        'enter the calculated values
        vMetricValue = convert_type(word(vValues,1,"|"),"N")
        vEnglishValue = convert_type(word(vValues,2,"|"),"N")
        DataSubmitted.VALUE_ANSWER_STD_METRIC = word(vValues,1,"|")
        DataSubmitted.VALUE_ANSWER_STD_ENG = word(vValues,2,"|")

        end if 'vFn longer than 3

        That should give you something to chew on....
        Pat Bremkamp
        MindKicks Consulting