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

<tbl>.fetch_find() - Conflicting expression Data types

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

    <tbl>.fetch_find() - Conflicting expression Data types

    I have written a script that is designed to be ran from an external database. The scripts purpose is to document tables/sets and some details about the structures.

    I have used the Fetch_find() several times in the script, frequently when I run the script I will receive "Conflicting expression data types". Usually the error message is tied to line #76, 149, & 172. I have not received an error message tied to the use of the Fetch_find() on line 43 as of yet.

    It is my understanding that I am setting the index to a character value and am doing a Fetch_find() using a character value. I am struggling on how to develop an approach on troubleshooting this. Up till now its just been a guessing game that I am losing at horribly.

    I have attached a copy of the database, the script "Documenter" will need to be edited for the environment that it is ran in. The following lines will need to be changed to point to the proper file paths. (Side challenge - anyway to have the table paths be dynamic so they work no matter where you put the database?)
    Code:
    Dbs = "X:\DB_Doc\Dbs.dbf"
    Tbls = "X:\DB_Doc\Tbls.dbf"
    Flds = "X:\DB_Doc\Flds.dbf"
    Sets = "X:\DB_Doc\Sets.dbf"
    Child_tbls = "X:\DB_Doc\Child_tbls.dbf"
    When I run the script I am usually in an interactive window of a sperate database and execute. Again the path will have to be modified to fit the enviroment
    Code:
    script_play("Documenter@x:\db_doc\db_doc.alb")
    Any help or comments are appreciated.

    Thank you for your time
    -Andy
    Andrew

    #2
    Re: &lt;tbl&gt;.fetch_find() - Conflicting expression Data types

    I didn't try your zip, but am doing something like this already.

    the index definition must match the search key - but it does not have to ba a character

    like the index for "clients" is on lastname and named lastname

    t=table.open("c:\somefolder\someotherfolder\clients")
    '(I am referencing a table outside the current database)
    t.index_primary_put("lastname")
    variable="Smith"
    rec=t.fetch_find(variable)
    if rec > 0
    msgbox("","foundit")
    else
    msgbox("","didn't find it")
    end if
    t.close()
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    Comment


      #3
      Re: &lt;tbl&gt;.fetch_find() - Conflicting expression Data types

      The reason you are getting that error message is because you have ti index the table with whatever field you are searching on. For example. If I want to find the record that contains the first_name="Mario"

      pTbl=table.open('names.dbf') 'Open table
      pTbl.index_primary_put('names') ' Here is where you get the problem.Make sure you have an index with the field you are searching

      pTbl.fetch_first()
      nRec=Ptbl.fetch_find("Mario") 'It can also be a variable that contains "Mario"
      pTbl.fetch_goto(nRec)

      etc....


      I hope this helps.
      The Mexican

      Comment


        #4
        Re: &lt;tbl&gt;.fetch_find() - Conflicting expression Data types

        Based on my table design each record in the children tables have two identifying fields that combined make the record unique. My first attempt at making indexes I tried to have the index include both fields. I had an issue where if I opened the database in Version 5 I would lose the index. I also wasnt sure I could use the <tbl>.fetch_find() on an index that is an concatenation of two fields, one being numeric the other character. Those are the reasons why I choose not to use indexes originally.

        Instead I opted to make queries that would would sort on a character field and then filter on the numeric field. It was my understanding that by placing the sort on the character field I could perform the <tbl>.fetch_find() on the same character field simply by using a variable argument that was of the character type. This method works sporadically which is why I made the post.

        When I attempt to run the script sometimes it will complete without an error message, other times it will only be able to scan a couple of tables prior to throwing an error message.

        *edited info

        Forgot to mention that after seeing the posts I created indexes on the fields that I am attemping to do the <tbl>.Fetch_find() on. But because I need to filter the table as well, I am doing a <tbl>.Index_primary_put() to set the index then running a <tbl>.Query_create() immediately afterwards. Then I tested the script and still received the error message.
        Last edited by aschone; 06-04-2007, 11:08 AM.
        Andrew

        Comment


          #5
          Re: &lt;tbl&gt;.fetch_find() - Conflicting expression Data types

          I believe that I have eliminated the index errors that I was receiving, but in order to make the script work I had to do a lot more error checking than I expected.

          First and foremost I discovered that if your index configuration contains anything other than just the field in the "order expresion" your index will be lost if you try to open the database in version 5. If you recreate the index in version 5 then open the database in version 8 the index again will be gone. Because of this my script now handles this problem and will re-create the index on the fly via <tbl>.index_tag_add(). This issue was the original reason why i choose to use a query instead of an index to begin with.

          The next issue has to do with the <tbl>.fetch_find() function. I am running this function inside of a for..next loop. I would assume that if I apply a query or an index prior to entry of the for..next loop that it would stay in effect the entire time I left the table pointer open for processing. This was simply not the case. Sporadically I would receive "Conflicting expression Data types" error messages. Never did this error occur on the first loop of the for..next loop. It would only happen on the 2nd or subsequent loops. I have discovered that somehow the table would revert back to the recno index and this is what caused the error. While I have resolved the issue, I would like to understand why this happened.

          To resolve the issue with the index changing sporadically while in mid process I now set the filter using <tbl>.index_primary_put(). I do this just before I run the <tbl>.fetch_find() command.
          Andrew

          Comment

          Working...
          X