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

Expression Builder quirky behaviour for Numeric Fields.

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

    Expression Builder quirky behaviour for Numeric Fields.

    I am running into a scenario where the calculated field expression / builder window is not giving me the resolution results for numeric fields. However, they are resolving correctly in the layout view. I have tried closing / reopening database and issue still persists. They were displaying OK earlier this evening. Now, when I want to edit N fields I can't see impact of any changes.

    Any ideas?

    #2
    here is screen shot



    Sorry, should have included this as well.

    Comment


      #3
      Ken,

      The LOOKUPN() passes an expression to be evaluated, but does not evaluate an expression in the parameter of a lookup as anything but a string to be passed to the function. Your code would have to be something more like

      F5/100*(VAL(F5/100*(VAL(ALLTRIM(RATEPERIOD))+LOOKUPN("F","LIFEi,"premium","rate.dbf","Irate"))
      LOOKUPN("F",ALLTRIM(RATEPERIOD)+"LIFEi,"premium","rate.dbf","Irate")

      If RatePeriod is a number and a field within rate.dbf, then it probably needs to be something like

      F5/100*LOOKUPN("F","RATEPERIOD+LIFEi,"premium","rate.dbf","Irate")

      But it's not clear what you want to return and evaluate. Let's say RATEPERIOD was equal to " 123 "
      In your version, the term

      LOOKUPN("F",ALLTRIM(RATEPERIOD)+"LIFEi,"premium","rate.dbf","Irate")

      would then be the same as

      LOOKUPN("F","123"+"LIFEi,"premium","rate.dbf","Irate")

      or more simply

      LOOKUPN("F","123LIFEi,"premium","rate.dbf","Irate")

      What does the return expression evaluate to in the rate table's record? It's garbage, and hence your problem.
      Regards,

      Ira J. Perlow
      Computer Systems Design


      CSDA A5 Products
      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
      CSDA Barcode Functions

      CSDA Code Utility
      CSDA Screen Capture


      Comment


        #4
        Ken, does your problem go away when you reopen the database after shutting Alpha Five down?

        -- tom

        Comment


          #5
          Originally posted by Tom Cone Jr
          Ken, does your problem go away when you reopen the database after shutting Alpha Five down?

          -- tom
          I tried that and it didn't. I am suspecting the lookup(N) is the area to focus on since my other N expressions display this correctly
          RESULT: ....
          TYPE: N

          I know it was working since that was how I determined the correct coding by looking at RESULT data
          Last edited by ken doucet; 03-18-2006, 08:25 AM.

          Comment


            #6
            Originally posted by csda1
            Ken,

            The LOOKUPN() passes an expression to be evaluated, but does not evaluate an expression in the parameter of a lookup as anything but a string to be passed to the function. Your code would have to be something more like

            F5/100*(VAL(F5/100*(VAL(ALLTRIM(RATEPERIOD))+LOOKUPN("F","LIFEi,"premium","rate.dbf","Irate"))
            LOOKUPN("F",ALLTRIM(RATEPERIOD)+"LIFEi,"premium","rate.dbf","Irate")

            If RatePeriod is a number and a field within rate.dbf, then it probably needs to be something like

            F5/100*LOOKUPN("F","RATEPERIOD+LIFEi,"premium","rate.dbf","Irate")

            But it's not clear what you want to return and evaluate. Let's say RATEPERIOD was equal to " 123 "
            In your version, the term

            LOOKUPN("F",ALLTRIM(RATEPERIOD)+"LIFEi,"premium","rate.dbf","Irate")

            would then be the same as

            LOOKUPN("F","123"+"LIFEi,"premium","rate.dbf","Irate")

            or more simply

            LOOKUPN("F","123LIFEi,"premium","rate.dbf","Irate")

            What does the return expression evaluate to in the rate table's record? It's garbage, and hence your problem.
            The rateperiod is text and LifeI as well. The two of them combined give me the key value in the index IRATE i.e. newlifei would be a record in rate table that returns a number like 1.394 and I use in multiplication with F5(N)/100 to generate N result.

            Comment


              #7
              ken, are you trying to do

              (F5 / 1000) * lookupn()
              or

              F5 / (1000 * lookupn() )
              ???

              What is F5, and what is it's value when the expression editor tries to evaluate the expression? If table field, check the value. If variable, is it populated? is it in scope?

              -- tom

              Comment


                #8
                Originally posted by Tom Cone Jr
                ken, are you trying to do



                or



                ???

                What is F5, and what is it's value when the expression editor tries to evaluate the expression? If table field, check the value. If variable, is it populated? is it in scope?

                -- tom
                F5 (N) that itself is set to be 60000 if F4(L) is .T.
                then the (F5/1000)*lookupN........ is a formula that yields #of 1000 life insurance units which multiplied by the Lookup(N) formula (the premium per thousand). i.e. if F5 is 60000 then premium would be (60000/1000)*0.347 to yield the premium for that coverage.

                I am going out for 3 hours and will check thread as soon as I get back.

                Comment


                  #9
                  Ken, let me try again.

                  When you type F5 in the expression builder does it get properly evaluated?

                  Do you get the same results when you include the parentheses to separate F5/1000 from the lookupn() ?

                  -- tom

                  Comment


                    #10
                    Ken,

                    Originally posted by ken doucet
                    The rateperiod is text and LifeI as well. The two of them combined give me the key value in the index IRATE i.e. newlifei would be a record in rate table that returns a number like 1.394 and I use in multiplication with F5(N)/100 to generate N result.
                    Excuse a bit of my discussion, I had the key and return expression's backwards because I was typing at a machine that didn't have A5.

                    Nevertheless, I'll ask these questions to you.
                    1. Is rate.dbf in the same directory as the database (ADB file)? If not, provide a path to it.
                    2. What is the expression for Irate index, and the definition of it's fields that make it up?
                    3. So, for example, you are saying ALLTRIM(RatePeriod) evaluates to "new"? Add that to "LIFEi" results in a key of "newLIFEi".

                    Try just the lookup field in the expression, without the F5/1000. See if that works. Try a fixed key like "newLIFEi" (if that is correct) instead of a calculation.

                    Let us know how you make out.
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #11
                      Originally posted by csda1
                      Ken,



                      Excuse a bit of my discussion, I had the key and return expression's backwards because I was typing at a machine that didn't have A5.

                      Nevertheless, I'll ask these questions to you.
                      1. Is rate.dbf in the same directory as the database (ADB file)? If not, provide a path to it.
                      2. What is the expression for Irate index, and the definition of it's fields that make it up?

                      3. So, for example, you are saying ALLTRIM(RatePeriod) evaluates to "new"? Add that to "LIFEi" results in a key of "newLIFEi".

                      Try just the lookup field in the expression, without the F5/1000. See if that works.
                      Try a fixed key like "newLIFEi" (if that is correct) instead of a calculation.

                      The
                      Let us know how you make out.
                      1- yes
                      2- character fields made up of PERIOD(C) and TYPE(C)
                      3- Correct

                      If I key this (F5/1000) the value resolves correctly (expected value returned). However,the Lookup field does not show RESULT TYPE yet the results are correctly computed and displayed in the layout view i.e. I change F4 value from .T. to .F. and data cycles to 0 (as it should) and then if I switch it back to .T. the correct N results display.

                      In light of this should I try adding another field to my RATE table that is a join of the two fields?

                      Comment


                        #12
                        Are you sure the index in the lookup table trims the rate period? If not, determine the length of the Rateperiod field and make sure it is the same length in the lookup expression. If it is 10 characters, something like this:

                        padr(RATEPERIOD,10," ")+"LIFEi"


                        Another general hint: I've occasionally had problems with lookups that only use the table name even when the table is in the current folder. Adding the full path always solved the problem so I now make all table references in lookups like this:
                        A5.Get_path() + "\rate.dbf"

                        The errors I got said the table couldn't be found so it's not the same thing you are seeing here. This is just a "JIC" warning.

                        Comment


                          #13
                          Originally posted by CALocklin
                          Are you sure the index in the lookup table trims the rate period? If not, determine the length of the Rateperiod field and make sure it is the same length in the lookup expression. If it is 10 characters, something like this:

                          padr(RATEPERIOD,10," ")+"LIFEi"


                          Another general hint: I've occasionally had problems with lookups that only use the table name even when the table is in the current folder. Adding the full path always solved the problem so I now make all table references in lookups like this:
                          A5.Get_path() + "\rate.dbf"

                          The errors I got said the table couldn't be found so it's not the same thing you are seeing here. This is just a "JIC" warning.
                          Just tried the get_path ... no change.

                          The field Rateperiod is (C) max length 5 char.

                          Tried the padr... and this did not do anything either.

                          Comment


                            #14
                            Another item that may factor into this?

                            My original RATE table was modelled on my old DOS database and the link was a dummy field called TIE(C) defaulting to "a". All my records in the Health Master table had a default field called TIE(C) defaulting to "a". I revamped my single record RATE table which necessitated complicated lookups - based on advice in another thread I now have multiple records in RATE table and do a LookupN() to grab the relevant premium.

                            Is it possible my set using the TIE linking field has created this issue? This is my first usage of LookupN() so am not sure if I have inadvertently created this problem at the set leve.

                            If it weren't for this current issue, I would have effectively remodelled this one area of my DOS table in a far more compact and efficient way. The coding, once I got into it is much easier thanks to inlist() etc..

                            I appreciate any help I can get with this.

                            Comment

                            Working...
                            X