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 property for decimal places

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

    Dynamic property for decimal places

    I have a numeric table field that has been defined to have 5 decimal places. I'd like to use dynamic properties on a report to show a different number of decimal places, such as 2.

    I've tried many variations of using the Field "Dec" dynamic property, and no matter what I do, the field always shows 5 decimal places. I've set no other property. I've just dragged the field to a report and modified the "Dec" property.

    How do I use the dynamic property to change the field's display/report characteristics?

    #2
    Re: Dynamic property for decimal places

    Bill,
    You could simply use a calculated field for this. Something like...

    round(your_field_name, 2)

    What are your "dynamic properties" ? If it is from say a variable that is set, just use a numeric variable for the number of decimals like...

    round(your_field_name, your_numeric_variable_name)

    There are ways to change the formatting of the actual field as well with xbasic I believe if that is what is wanted, but for various "views" of a field, using a calculated field is probably the easiest.

    Hopefully I guessed as to what you wanted......
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #3
      Re: Dynamic property for decimal places

      Thanks for the suggestion, Mike. That doesn't quite work because a field or calculated value obeys the format, even after ROUND(). That is, if calcval = round(fieldname,2) has a format of 5 decimals, it will display 5 decimals.

      I just want to change the format, which is what I thought dynamic properties would do. If it won't, what is the role of a dynamic property for the Decimal?

      Comment


        #4
        Re: Dynamic property for decimal places

        Bill

        When do you want to change the decimal representation to 2 from 5. Would it be based on something or do you just want it to show that way in the report everytime it is printed?

        You can change the format of the numeric field to 2 decimals from 5 when you report is in design mode, click on that field and select properties, then go to the format tab, at the bottom of that tabbed form you can then change the decimal from 5 to 2.

        Once you do that, everytime you run the report the number of decimals for that field would always be 2.

        Or are you talking about the new property grid (selected from tasklist, properties)?

        Just guessing as Mike already said.

        Tom Baker

        Comment


          #5
          Re: Dynamic property for decimal places

          Thanks, Tom. For clarification, I've uploaded a composite image of what I'm doing/seeing. Top part is my setting of the property, as you guessed. Bottom part is the relevant section of the report.

          I want to dynamically change the # of decimals shown, not hard code it into a report as you described.

          My table field is set for 5 decimals. I set a global variable, vNumDecimals, and set its value to 2. That's shown on the report. I've set the dynamic property for "Dec" to my global variable, but the report still shows the 5 decimals of the field.

          Is there a reason why that shouldn't work?

          Comment


            #6
            Re: Dynamic property for decimal places

            This is something I use (and like a lot) for a different purpose, but it should work here. In fact it seems Alpha's dynamic property might do something like this.

            Code:
            FUNCTION entry_format.num.sigd2c AS C (value AS N, width AS N, decimals AS N )
            'Description:Significant decimals only, 2 minimum, commas
            'maximum decimals is field definition.
            Dim significant_decimals as c
            Dim decimal_count as n
            
            'get display decimal count
            significant_decimals = word("" +round(value,decimals),2,".")
            decimal_count = len(significant_decimals)
            decimal_count = max(decimal_count,2)
            
            entry_format.num.sigd2c = alltrim(str(value,width,decimal_count,","))
            
            END FUNCTION
            After you add this function to your Code tab, a format option of "sigd2c" will be in the format list for numeric fields when you are in design mode, Properties, format tab.

            I use this particular function to display all significant decimals, with a minimum of 2, and with comma formatting. Change the function to do what you need, e.g. add a global variable with the decimal count. The last segment of the function name can be changed but is limited to 6 characters.

            Bill.

            Comment


              #7
              Re: Dynamic property for decimal places

              Bill, that function is very helpful and it does perform the specific task at hand. Thanks.

              A big part of my question is getting dynamic properties to work, because it should be so easy to accomplish what your function does with them. Decimals aren't the only dynamic property I want to use.

              Any ideas why setting the dynamic property does not work?

              Comment


                #8
                Re: Dynamic property for decimal places

                I'm still confused as to what dynamic properties are--is not in my version of QRB10 which is based upon Alpha v10. Sure looks like this is a property sheet of the webside...


                EDIT--I do see it now--just have not done much in v10 yet as QRB10 is not quite ready for showtime yet!! :)
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Dynamic property for decimal places

                  Yes, dynamic properties are a big feature of Alpha v10. It's certainly not in QRB 9.

                  Comment


                    #10
                    Re: Dynamic property for decimal places

                    Bill,
                    I cannot get it to work either---I will check into it a bit further......
                    Mike
                    __________________________________________
                    It is only when we forget all our learning that we begin to know.
                    It's not what you look at that matters, it's what you see.
                    Henry David Thoreau
                    __________________________________________



                    Comment


                      #11
                      Re: Dynamic property for decimal places

                      Well,
                      I can change it with Object Explorer.....but guess it is another property listed like that that cannot be changed.....could be by design as all of the prior inabilities have been determined to be...or just slipped by. Cannot change via relative/explicit code via Object Explorer syntax or with the Dynamic property as you tried.

                      I would report it to see if it is something that Alpha is planning on having as a feature--I agree it would be nice to be able to set any property easily like you are wanting. I cannot report it as I only have QRB10 currently, not full version Alpha10.
                      Mike
                      __________________________________________
                      It is only when we forget all our learning that we begin to know.
                      It's not what you look at that matters, it's what you see.
                      Henry David Thoreau
                      __________________________________________



                      Comment


                        #12
                        Re: Dynamic property for decimal places

                        Thanks, Mike.

                        One unrelated twist I came across when using the dynamic "align" property: if you dynamically set "right" alignment for a calculated value that is conditionally displaying 1 of several values, which could be text or a number, Alpha allows setting an ellipsis, which, if set to "end ellipsis", breaks the right alignment of the number.

                        If you use dynamic properties to allow you to conditionally display fields because now you can format them, you can end up with the ability to make settings that don't work together.

                        Comment


                          #13
                          Re: Dynamic property for decimal places

                          Definitely something to remember if/when this feature can be used....but no different really than other aspects of developing where a conflict can be created....even users can cause such say when allowed to filter on everything.
                          Mike
                          __________________________________________
                          It is only when we forget all our learning that we begin to know.
                          It's not what you look at that matters, it's what you see.
                          Henry David Thoreau
                          __________________________________________



                          Comment


                            #14
                            Re: Dynamic property for decimal places

                            This is still not working and would like to know how to properly set up the code that was indicated, i placed it in the code tab in control panel but still not seeing that option appear in the format list.

                            Comment


                              #15
                              Re: Dynamic property for decimal places

                              Did you try?
                              right click on the field in the report - properties - format and change it to show 2 decimals. It will auto round for you there.

                              If you need your own special rounding, create a calc field in the report and then place the calc field in place of the questioned field on the report.
                              Dave Mason
                              [email protected]
                              Skype is dave.mason46

                              Comment

                              Working...
                              X