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

Field Selection by Expression or Variable

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

  • Field Selection by Expression or Variable

    I need to write a variable in one of seven different fields, depending on the value of another variable or expression.

    I could write a chain of If... Elseif.. conditionals but this would be very clumsy.

    Is there a better way of doing it?

    Thanks

    Robin

  • #2
    I wonder if the Select / End Select function would be a good solution for you.
    -Steve
    sigpic

    Comment


    • #3
      Thanks Steve, but Select... Case etc. is really only a variation on If... Else if...

      I would still have to have the action to be taken mentioned seven times.

      What would be very useful to me is to be able to specify the control in which the data is to be inserted as part of an array, eg. Box[n] where n is from 1 to 7

      But I don't think we can do that... sigh...

      Cheers

      Robin

      Comment


      • #4
        Well, maybe someone else understands what you want to do -- I guess I don't. If no one else answers and you'd like to 'splain some more then maybe other solutions can be suggested. Even if it's not in "perfect" Xbasic or whatever, perhaps write out the logic-stream that you want to create.
        -Steve
        sigpic

        Comment


        • #5
          Sorry Steve if I am not clear!

          I have seven small textboxes on a form I call "Historic Person". These correspond to the British census years 1841 - 1901

          I have another form called "Individual" which has a unique index number, plus the census year, and a textbox in which the I want the user to be able to optionally insert the index number of a selected "Historic Person" form.

          On doing this the "Individual" index number is to be written in the small textbox on the "Historic Person" form which corresponds to the correct census year.

          This will result in a person looking at the "Historic Person" form being able to see which individual census records may correspond with the H.P.

          Clear as mud?? Genealogy can be a bit confusing.

          I have put pictures up on my website

          http://robin.net.nz/census

          which may make things more understandable!

          Thanks for your interest

          Robin

          Comment


          • #6
            Robin,

            Why do you have separate fields for each census? When I see repeating patterns I wonder if the table structure is correct. If you had a single "census year" field, you could define a simple list field rule lookup for it, so that the user could only enter 2001, 1991, 1981, etc. Then, regardless of what census year pertains to an "individual" only a single field in the "historic person" form would have to be updated.

            Your present design makes this complicated if you later want to find an "individual" in the "historic persons" table. You now have to search all 7 census fields in all records, since you may not know which census year pertains to the "individual" you are searching for. Much much easier to only have to search one field.

            -- tom
            Last edited by Tom Cone Jr; 01-06-2006, 02:41 PM.

            Comment


            • #7
              Simplistic example

              Originally posted by Robin Hoare
              Sorry Steve if I am not clear!

              I have seven small textboxes on a form I call "Historic Person". These correspond to the British census years 1841 - 1901

              I have another form called "Individual" which has a unique index number, plus the census year, and a textbox in which the I want the user to be able to optionally insert the index number of a selected "Historic Person" form.

              On doing this the "Individual" index number is to be written in the small textbox on the "Historic Person" form which corresponds to the correct census year.

              This will result in a person looking at the "Historic Person" form being able to see which individual census records may correspond with the H.P.

              Clear as mud?? Genealogy can be a bit confusing.

              I have put pictures up on my website

              http://robin.net.nz/census

              which may make things more understandable!

              Thanks for your interest

              Robin
              Not sure I understand it all but the attachment uses two variables (acval and which) and writes the contents of "var->acval" to a field (cfld1 thru cfld7) depending on the contents of "var->which".

              Maybe it will get you started.

              No error checking is included to validate that the field actually exists - IOW it will attempt to write to cfld212 if 212 is entered in var->which, and fail.
              Last edited by Stan Mathews; 03-28-2006, 03:24 PM.
              There can be only one.

              Comment


              • #8
                Tom:

                Because (one hopes) all or some of the seven spaces will be filled with "Individual" numbers so that one may trace the Historic Person's census records through the years. Often there is doubt about whether one has the right records, especially with a name like John Brown (and I have one of him!)

                Thanks

                Robin

                Comment


                • #9
                  Robin,

                  Ok. The classic database approach to this would be to create a child table and link it one to many to the parent. Each Historic Person record would be linked to one or more child table records each of which would hold the HP id, the Individual Id, and a census year. You'll have to add a field to the structure of your HP table when the 2011 census becomes available. Right? You have to set aside storage in each HP record for 7 census fields even if some will never be used. Right?

                  If you used a separate table you'd just write a new record to capture the Individual ID and link it to an HP.

                  If you keep your present structure you're going to have to write the kind of Select / End Select sequence (or If, Elseif, Elseif...) as you initially supposed.

                  -- tom

                  Comment


                  • #10
                    Thanks, Stan: I will work along those lines. The sample database was very helpful. So much compressed in so few instructions!

                    Tom: thanks for that. When the 1911 census becomes available I will be able to sell an updated version, I hope! Then there should be available Alpha 5 version 12, I expect, easier than ever to use!

                    Robin

                    Comment


                    • #11
                      Just to report success! Thanks to all who answered me. I had to struggle with XBasic for the first time and adapted Stan's suggestion: I'm sure it's all very good for me. Who needs to play bridge or chess for mental exercise?

                      Kia ora

                      Robin

                      Comment

                      Working...
                      X