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

Field Rules and Xbasic

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

    Field Rules and Xbasic

    I have a table with over 200 fields that all have default values. If I go directly to the table and ENTER a record all the default values are properly entered by the field rules. (load at start of entry).

    When I enter a record via a script. The record is entered and saved however NONE of the default values are there. What command do I have to add to my script to get the default values to be loaded? The script and entry is working fine other than this.

    Thanks

    #2
    RE: Field Rules and Xbasic

    Philip:
    Just a guess
    when you open the table t=table.open(xxxx")
    there is a command to Honor Field rules.
    not sure of the syntax.
    Charlie Crimmel

    Comment


      #3
      RE: Field Rules and Xbasic

      Thanks to Tom Cone for this:

      If you enter data by means of table.open("xxx"), the field rules are NOT enforced.

      However, if you put a button on your form, and make the script;

      tbl=table.current()
      tbl.enter_begin(.t.) ' or enter_begin(honor_field_rules)
      etc....

      then it works.

      Comment


        #4
        RE: Field Rules and Xbasic

        Bill,
        Neither format worked. Here is the simple code.

        tblavail.enter_begin()
        tblavail.ref_num = tblref.ref_num
        tblavail.first = tblref.first
        tblavail.last=tblref.last
        tblavail.enter_end(.T.)

        The rest of the table has about 60 dates fields 120 character fields, and 60 logical fields and these all have default values that are not being loaded.

        Thanks

        Comment


          #5
          RE: Field Rules and Xbasic

          Philip -

          Where do the default's come from ? - or, for the purist's,
          from where do the defaults come ?

          If the defaults are common data, that is , the same in
          every record, wouldn't it make sense to link this file
          to the source of the (common) data rather that duplicating
          it ?

          Lowell

          Comment


            #6
            RE: Field Rules and Xbasic

            The information is for a 10 week soccer season. (excluding Sunday) This info is on what we call an availability sheet. We will be inputing information for each day of the season for availability, before a certain time, after a time or just not available. If you can think of a better way I would listen. All the defaults for each day are defined in the respective field rules.

            Comment


              #7
              RE: Field Rules and Xbasic

              Philip:

              I don't think that the default value rules fall into the category of those which are honored or disregarded by honor_field_rules.

              So if that doesn't work, I suggest that you simply create a single record table which contains all the fields you need to replicate populated with the default data. (You can probably get this very easily with table.duplicate) Then, to add new records into your active table you would

              t1=table.open("active")
              t2=table.open("source")
              t2.fetch_first()
              defaultdata=t2.record_data_get()
              t1.enter_begin()
              t1.record_data_set(defaultdata)
              'enter any other data into t1 here
              t1.enter_end(.T.)
              t1.close()
              t2.close()

              I have a table like this that has 7 variations of default values that I use when autoentering records in our appointment scheduler.

              Finian
              Finian

              Comment


                #8
                RE: Field Rules and Xbasic

                Philip, I tried a sample table with a default value in the field rules, and it did work. I notice that your codes does NOT have tblavail=table.current(). This line is what makes the field rules work. Did you just forget to show it, or is it not there? If not, try putting it in the code. Remember, tblavail=table.open("table_name") does NOT work with the field rules.

                Comment


                  #9
                  RE: Field Rules and Xbasic

                  That is where my problem is. I have a button on my main menu that activates a script that will have nothing but "Script_play" commands. I figure that by the time I get done I may have 20 different modules. I have been modulating the project to make trouble shooting easier. The button is attached to a table by the name of referee.

                  I did a search on the xbasic pdf info and found that I could do a form.load to activate the field rules. However I cannot get it to work. Look at page 139-140 in the pdf file and tell me what TABLES is in the example. I cannot figure that out.

                  Here is how I start the script

                  tblref=table.open("referee")
                  tblavail=table.open("availsht")
                  tblvar=table.open("variables")

                  How can I get the above to work with the ENTER script that I posted earlier and the form.load command?

                  Finian, I am not ruling out you suggestion as I have a single record table that is called variables.

                  Thanks

                  Comment


                    #10
                    RE: Field Rules and Xbasic

                    Phillip,

                    I think most table level field rules were designed with the idea that data entry would be occuring through a form, with a user punching keys.

                    Look at the discussion of field rules which appears in the table.open() section of the xbasic ref. manual. User level interface field rules are not supported when adding or changing records using table.open().

                    Form.load() will permit you to open a form invisibly, but then manual indicates that if you want the field rules enforced as you enter records 'through' the invisible form you will need to use form methods, not table table methods. i.e. form.new_record()

                    -- tom

                    Comment


                      #11
                      RE: Field Rules and Xbasic

                      Philip, I also noticed that Bill's script has:

                      tbl.enter_begin(.T.)
                      or
                      tbl.enter_begin(honor_field_rules)

                      This is important!!!

                      tbl.enter_end(.T.) is NOT the same thing!

                      Comment


                        #12
                        RE: Field Rules and Xbasic

                        This is what I had to do to get it to work. Because I was using the tbl.open() and the field rules were ignored. By using the form rules the field rules were accepted. I still don't know why TABLES has to be included. I cannot find anywhere in the documentation about this. Also what command do you use to clear the form from Memory. I tried using the :form.close("availsheet") and I keep getting an error that the form could not be found.

                        :form.load("availsheet")
                        :availsheet:tables:availsht.enter_begin(honor_field_rules)
                        :availsheet:tables:availsht.ref_num = tblref.ref_num
                        :availsheet:tables:availsht.ref_first_name=tblref.firstname
                        :availsheet:tables:availsht.ref_last_name=tblref.lastname
                        :availsheet:tables:availsht.enter_end(.T.)

                        Thanks for the help.

                        Comment


                          #13
                          RE: Field Rules and Xbasic

                          :availsheet.close()

                          I misunderstood your original post. I thought you were entering lots of new records all at once.

                          Comment

                          Working...
                          X