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

Script "Property Type Mismatch" error

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

    Script "Property Type Mismatch" error

    Hello forum,
    I have the following script attached to a OnChange event and it only sometimes produces the "Property Type Mismatch" error and I can't realiably produce the stopping of the error. The error occurs always on the first start of the form but sometimes stops and the script works properly. Also always works fine on V5 im running V4.5 266.

    dim comp as p
    comp=table.open("main")
    comp.update_production_index()
    ix=comp.index_primary_put("xselect")
    nrec=ix.records_get()
    comp.fetch_first()
    xaxis.choice.list.redim(nrec)
    yaxis.choice.list.redim(nrec)
    for i=1 to nrec
    xaxis.choice.list[i].text=comp.year
    xaxis.choice.list[i].value=comp.year
    yaxis.choice.list[i].text=comp.year
    yaxis.choice.list[i].value=comp.year
    comp.fetch_next()
    next i
    comp.close()

    The error is produced by the line

    xaxis.choice.list.redim(nrec).

    This script is used on other forms and always works fine the only difference is the index which is used. In the case that doesn't work the index has a filter expression of REG=VAR->GROUP, with the VAR->GROUP being the field with the onchange event attached (when removed the scripts works but doesn't do it's job!). This is a problem produced when trying to get a form to do what I decscribed in a post from last week entitled "Changing listbox contents on the fly" which is what this script does in V5 but produces this error in V4.5

    Any help or ideas on how to do this differently will be appreciated.

    Thanks

    Rich

    #2
    RE: Script

    Rich,

    there are several constructs in your code that look unfamiliar to me, but I have little experience with listboxes.

    OnChange event probably doesn't update your index. If your script assumes that the filtered index has been updated when it runs this may be part of an explanation for what you're seeing.

    -- tom

    Comment


      #3
      RE: Script

      Thanks Tom, I thought the line

      comp.update_production_index()

      was producing the index update but after further investigation this is not correct. The error I am experiencing is because the listbox array length is defined as 0 which produces the error! But how do I actually update the index's?

      I have changed the single line to

      index_create_begin("uni", "STUFF(CODE,4,1,YEAR)", "", "I")
      index_add("REG", "REG", "", "IU")
      index_add("YEAR", "YEAR", "", "I")
      index_add("XSELECT", "year", "reg=var->group", "IU")
      index_create_end(db_current(), "MAIN.CDX")

      and this still doesn't work!

      Rich

      Comment


        #4
        RE: Script

        Richard,

        comp.update_production_index() will update an index, however OnChange is a field event. It fires when the contents of a field in the form layout changes. This has nothing to do with when a record is updated or committed to the table. I think you can update the index all day long, but until the form with pending changes has been committed to the table I don't think the changed values will be reflected in the index list. Still dont' know if this is relevant to your situation, but wanted to clarify further for you.

        -- tom

        Comment


          #5
          RE: Script

          I'm not sure whether it is relevent either as the field is a global variable not part of a record, so at no point is the database written to. What I wanted to do was as the contents of the global variable changed it updated the indexes in the database which were reliant on that global variable. The script below works but when on a button or on a field event for a non related field.

          comp=table.open(A5.get_master_path()+"main.dbf")
          comp.update_production_index()
          comp.close()

          comp=table.open(A5.get_master_path()+"main.dbf")
          ix=comp.index_primary_put("xselect")
          nrec=ix.records_get()
          comp.fetch_first()
          xaxis.choice.list.redim(nrec)
          yaxis.choice.list.redim(nrec)
          for i=1 to nrec
          xaxis.choice.list[i].text=comp.year
          xaxis.choice.list[i].value=comp.year
          yaxis.choice.list[i].text=comp.year
          yaxis.choice.list[i].value=comp.year
          comp.fetch_next()
          next i
          comp.close()
          END

          if on the onchange event then the x and yaxis content are changed one click behind the var->group change. This only happens once for every onarrive event of the changing field. It works as it should in v5.

          p.s. the reason for getting it working in 4.5 is that i have the runtime for that and not for V5

          Thanks again

          Rich

          Comment


            #6
            RE: Script

            if a this.refresh() is added at the beggining of the onchange event then in 4.5 the selected row goes back to the orginal selected row eveytime it is changed. In V5 though the this.refresh() has no effect and the change of the listbox row happens as normal. This appears to be why it works in v5 and not in 4.5 as script needs to run after the value of the list box is changed which is not happening in 4.5 as shown by adding the this.refresh()!

            I have tried reading the listbox.value as a first thing and this is still the previous value not the one changed to!

            If there is a work around for this then that would be good if not then a completely different approach is what is needed!

            Comment


              #7
              RE: Script

              Rich

              Unless I am mistaken, v4.5 doesn't support dot variables. Since that is what you are using, the code will fail in V4.5. Code written in v5 is not backward compatible with v4.5. The best solution is to either do all of your developement in v4.5 or purchase the runtime for v5.

              Jerry

              Comment


                #8
                RE: Script

                I have now got the code to work as I want with adding a

                somethingelse.activate()

                as the first thing in the code!

                Comment

                Working...
                X