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

A calculated fill-in from a lookup table?

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

    A calculated fill-in from a lookup table?

    I have one table named P_Employ and another named C_Basic. I would like to be able to fill in the "Employer" field in P_Employ with the name of the person's employer, and employer's city and state from C_Basic.

    I have no problem creating the equation [trim(name)+", "+trim(city)+", "+state]. The problem is that using lookups in the field rules only seems to allow filling in one field directly from one field from the lookup, not using a calculation.

    Is there a relatively easy way to accomplish this?

    Thanks in advance for your suggestions.

    Marilyn Wallace

    #2
    Yes, fill in the individual fields on the target table and then combine them when you need to with a calculated or rtf field.

    Keep data in it's elementary form. It's easier to combine than the split....
    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


      #3
      I already have the data stored once

      Al,
      I already have the data stored once in the C_Basic table. I planned to store it in a single field (rather than multiple fields to be combined later) for the following reasons:

      - The data is already in the C_Basic table. I am putting it here as a convenience, rather than creating a set and linking to C_Basic to see the information.

      - Since I have already devoted storage space in C_Basic with fields large enough to accommodate the largest entries, I would prefer to compress the information to a more modest size by trimming out the blanks and only storing up to 50 characters of the combination of name+city+state (which means in rare cases the state and part of the city will be eliminated).

      Marilyn Wallace

      Comment


        #4
        ok try this

        If you really must combime all in a calculated field,

        you can do a lookup on the name in an expression and add it to another lookup and add it to the third lookup. All in one calculated field.
        Example:

        trim(lookup(name,,,))+", "+trim(lookup(city,,,))+", "+Lookup(state,,,)

        does this make sense?

        Dave
        Dave Mason
        [email protected]
        Skype is dave.mason46

        Comment


          #5
          calc field

          this is an actual that I use as an alternative:

          compadd = lookupc("F","1","address","comp","group")
          compcistzip = lookupc("F","1","cstzip","comp","group")
          compname = lookupc("F","1","name","comp","group")
          comp = trim(calc->compname)+", "+trim(calc->compadd)+", "+calc->compcistzip

          gives: company, 123 main st, anywhere, state, 33333
          Dave Mason
          [email protected]
          Skype is dave.mason46

          Comment


            #6
            That did it! Thanks!

            Your solution works beautifully.

            Thank you very much, Dave.

            Marilyn Wallace

            Comment


              #7
              More details on this please?

              Originally posted by DaveM View Post
              If you really must combime all in a calculated field,

              you can do a lookup on the name in an expression and add it to another lookup and add it to the third lookup. All in one calculated field.
              Example:

              trim(lookup(name,,,))+", "+trim(lookup(city,,,))+", "+Lookup(state,,,)

              does this make sense?

              Dave
              Hi, all. How does one carry this out? I entered a variant of the above expression in the the calculated field-type field rule of my table. I didn't want a filter parameter, so I entered an empty "" after the first comma. But when I viewed my form (the field in question is in an embedded browse), nothing happens.
              Jim

              Comment


                #8
                Re: More details on this please?

                Originally posted by jmatienza View Post
                Hi, all. How does one carry this out? I entered a variant of the above expression in the the calculated field-type field rule of my table. I didn't want a filter parameter, so I entered an empty "" after the first comma. But when I viewed my form (the field in question is in an embedded browse), nothing happens.
                A calculated field is calculated during new record entry, when one of the fields involved in the calculation is modified, or when you invoke one of the recalculation methods.
                There can be only one.

                Comment


                  #9
                  Hi, Stan! Pardon my thickness, but I don't quite follow you. I want to do what Dave wrote:

                  Originally posted by DaveM View Post
                  ...you can do a lookup on the name in an expression and add it to another lookup and add it to the third lookup. All in one calculated field.
                  I entered the calculated field expression as suggested, but no lookup occurrred. I realize I'm missing something, since the expression does not accomplish a lookup at all, but is merely a string expression containing several lookup values. The question is, How should I supply the lookup values? I can't make a lookup field rule for a calculated field type.
                  Jim

                  Comment


                    #10
                    Re: A calculated fill-in from a lookup table?

                    The calculated fields I showed you are on a report. I have used the same scenario for a header on a form. This calculation method is a little strong for a form where you may want to change the data somehow since calc fields cannot be used for data entry or editing.

                    I would not combine the fields into another table. It is redundancy and I can always make the necessary calcs to combine later as needed. If I do a lot of this, a query in a udf would make much better sense.

                    Dave Mason
                    Dave Mason
                    [email protected]
                    Skype is dave.mason46

                    Comment


                      #11
                      Re: A calculated fill-in from a lookup table?

                      Originally posted by DaveM View Post
                      The calculated fields I showed you are on a report. I have used the same scenario for a header on a form. This calculation method is a little strong for a form where you may want to change the data somehow since calc fields cannot be used for data entry or editing.
                      Hi, Dave! Thanks for replying. I didn't realize you were talking about calculated fields on a report. What I wanted was a field rule at the table level that would combine fields from a table lookup into a single field.

                      I would not combine the fields into another table. It is redundancy and I can always make the necessary calcs to combine later as needed. If I do a lot of this, a query in a udf would make much better sense.
                      That makes sense to me, Dave. I'll take your advice on that. For that matter, it might be even better to just put in a foreign key and make a child table out of the lookup table, instead of duplicating the fields.

                      But, just out of curiosity, how would you make a field rule like I described? Is it possible?

                      Thanks in advance.
                      Jim

                      Comment


                        #12
                        Re: A calculated fill-in from a lookup table?

                        Jim,

                        I don't think you can define the table lookup field rule to autofill a table field with a calculated result obtained from the lookup table. The suggestions at the top of this thread contemplate autofilling fields, and then using a separate calc field rule to compute the calculated result and store it in yet another field in the same table. For good reasons you're after something a bit different.

                        The result you want to achieve could be obtained by defining your own custom lookup routine in the data entry form, rather than by using Alpha's built in field rules. You could supply a button which pops up a list from the "lookup" table and then the button's onPush event script could compute the desired result and assign it to a field in the current table.

                        Comment


                          #13
                          Re: A calculated fill-in from a lookup table?

                          Kinda like tom said?.?.

                          I would put the new field(hidden) on a form. As the data is entered and upon leaving the last entry field(or on save) trap the fields needed into variables, concatenate them like I want them and then set the hidden field with that data, which would be a variable. You could then do your lookup from field rules using only the one field. It would mean a large field in each table to save that data, but it would work.

                          There is also calculated fields for tables and sets now. Just an idea!

                          I am old school and remember when space on disk(sometimes a floppy disk) was of the utmost importance. Most people today don't remember ram drives and how we scrambled to get code to fit within memory, or how long it took to make a small .exe(I ate lunch while the computer churned. The only redundancy we could allow ourselves was the necessary fields to connect 2 or more tables.

                          Dave Mason
                          www.lotrun.com
                          Dave Mason
                          [email protected]
                          Skype is dave.mason46

                          Comment


                            #14
                            Re: A calculated fill-in from a lookup table?

                            Originally posted by Tom Cone Jr View Post
                            Jim,
                            I don't think you can define the table lookup field rule to autofill a table field with a calculated result obtained from the lookup table.
                            Hello, Tom! Coming from you, I'll take that as the definitive answer.

                            The result you want to achieve could be obtained by defining your own custom lookup routine in the data entry form, rather than by using Alpha's built in field rules. You could supply a button which pops up a list from the "lookup" table and then the button's onPush event script could compute the desired result and assign it to a field in the current table.
                            I never thought of that. I'll give it a try. Instead of a button, though, I'll have the lookup table pop up when the field gets focus.

                            Thank you very much for clearing that up.
                            Jim

                            Comment


                              #15
                              Re: A calculated fill-in from a lookup table?

                              Originally posted by DaveM View Post
                              Kinda like tom said?.?.

                              I would put the new field(hidden) on a form. As the data is entered and upon leaving the last entry field(or on save) trap the fields needed into variables, concatenate them like I want them and then set the hidden field with that data, which would be a variable. You could then do your lookup from field rules using only the one field. It would mean a large field in each table to save that data, but it would work.

                              There is also calculated fields for tables and sets now. Just an idea!

                              I am old school and remember when space on disk(sometimes a floppy disk) was of the utmost importance. Most people today don't remember ram drives and how we scrambled to get code to fit within memory, or how long it took to make a small .exe(I ate lunch while the computer churned. The only redundancy we could allow ourselves was the necessary fields to connect 2 or more tables.

                              Dave Mason
                              www.lotrun.com
                              Oh, hi, Dave! I didn't see your post when I came in! Thanks for the suggestion. I thought about how I could do something like that, but I'll go with Tom's suggestion for now, since it requires less fields.

                              I beginning to really appreciate what an asset this message board is. Thanks, all!
                              Jim

                              Comment

                              Working...
                              X