Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

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

Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

    This is an updated question regarding a topic that exists in the version 10 forum
    Post #735435

    The question results from not being able to dynamically format the number of decimal places in a report.
    I had originally posted these questions in the version 10 forum but I am on V12 and the issue will get more visibility here


    My situation is this, I want to vary (Dynamically!) the number of decimal places shown on the report for a field according to the magnitude of the number in that same field
    As the field value changes row by row in my report I want the number of decimal places to change depending on the following:
    If the value of the field is >=100 then I want zero decimal places
    If the value of the field is <100 then I want two decimal places

    I put the following expression in the expression builder (available at the DEC parameter of the Properties pane in the report writer)
    if(Field Name >=100,0,2) where in my case the Field Name is "Escalated_Cost_Per_Uom_3"
    This field is a calculated field created in a view in the MYSQL backend

    see attached pictures of the expression builder and the field selector screen
    Field Selector.jpgExpression Builder.jpg
    I could create no instance where this expression took hold and worked as I think it should
    I tried blanking out the decimal place settings in the various other places they can be set
    I tried with different field names in the expression
    I tried by entering a single number in the expression
    I tried publishing the report to Production environment

    I did note that the expression passed the internal testing for validity and completeness. It was returning valid results of 0 and 2 and the results changed as I clicked through the records in the dataset
    The result was a numeric type N
    <dynamic> even appeared in the DEC parameter line as I guess it should

    Does anyone know what I am doing wrong or if this feature works at all?
    I am on version 12.4.5.2 build 4770 of Alpha Anywhere V4.5.2 with system addins build 5018
    Also MYSQL56 5.6.39

    Thank you for any help you can offer

    Kevin Callanan
    Last edited by Kevin at LECESSE; 03-22-2018, 04:58 PM. Reason: reloaded pictures

    #2
    Re: Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

    Have to say... Alpha Report stuff is some of the oldest... and worst... I've ever come across. It's awful.

    The only way I could get the results you wanted was by creating 3 Calculated Fields and then using 2 of those fields in a Conditional Object.

    An "if" statement used anywhere simply does not work. If tried it in Dynamic Decimal and in Dynamic Format. I'm using the latest pre-release... so this has nothing to do with a release... and everything to do with how old and patched reports are.

    The calculated fields amt2 and amt3 are dragged into their respective Conditional Object conditions. CustAmount is my database field name. I'm not sure how your Field Type ExponentNumber affects anything.

    rptCond1.PNGrptCond2.PNG
    Last edited by Davidk; 03-23-2018, 12:52 AM.

    Comment


      #3
      Re: Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

      Conditional object

      Filter to determine the layer to display

      Place the field object on each layer.

      Adjust the format of each object to display the needed decimals
      Al Buchholz
      Bookwood Systems, LTD
      Weekly QReportBuilder Webinars Thursday 1 pm CST

      Occam's Razor - KISS
      Normalize till it hurts - De-normalize till it works.
      Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
      When we triage a problem it is much easier to read sample systems than to read a mind.
      "Make it as simple as possible, but not simpler."
      Albert Einstein

      http://www.iadn.com/images/media/iadn_member.png

      Comment


        #4
        Re: Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

        Even better... and cleaner... no need for calculated fields... and it rounds automatically when setting Dec to 0.

        Comment


          #5
          Re: Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

          I feel it as well David, but on more than reports - I sometimes wonder if we are all on a train wreck waiting to happen, the lack of attention to detail, and lack of robust testing, backward incompatibility and the long journey between official releases plus the recent security issue not to mention the response to submitting a bug report - all while under a subscription has me concerned. I recently had to go back to the official release and work, I cannot believe the issues I bumped into - I just had to shake my head an wonder about it all.
          Insanity: doing the same thing over and over again and expecting different results.
          Albert Einstein, (attributed)
          US (German-born) physicist (1879 - 1955)

          Comment


            #6
            Re: Dynamic formatting of number of decimal places in a report: Doesn't work. Bug or operator error?

            We have the same problem, maybe worse. We print a report where the number of decimals varies by line from 0 to 4 decimals. The solution was to realize that you can use a character field on the report. So we added a field to the table and created an SQL function 'num_to_str()' We feed in the number as decimal(12,8) and number of decimals we need and out pops the character representation formatted in the correct number of decimals. The report uses that character field instead of the numeric field. The following works in mariadb and mysql.

            FUNCTION `num_to_str`(p_Value decimal(16,4), p_Decimals tinyint(1)) RETURNS varchar(20) CHARSET utf8
            NO SQL
            DETERMINISTIC
            BEGIN
            /* num_to_str by Pat 07/01/2013
            takes a decimal value and the number of decimals and
            returns character representation */
            DECLARE v_Result varchar(20);
            SET v_Result = '';
            IF p_Decimals = 4 THEN
            SET v_Result = FORMAT(p_Value,4);
            ELSEIF p_Decimals = 3 THEN
            SET v_Result = FORMAT(p_Value,3);
            ELSEIF p_Decimals = 2 THEN
            SET v_Result = FORMAT(p_Value,2);
            ELSEIF p_Decimals = 1 THEN
            SET v_Result = FORMAT(p_Value,1);
            ELSE
            SET v_Result = FORMAT(p_Value,0);
            END IF;
            SET v_Result = REPLACE(v_Result,',','');
            SET v_Result = trim(v_Result);
            RETURN(v_Result);
            END
            Pat Bremkamp
            MindKicks Consulting

            Comment

            Working...
            X