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

fetch_find in an embedded browse

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

    fetch_find in an embedded browse

    The following script worked for years (in all builds up to and through 1491_1048). In all builds later than 1491_1048 indexes seem to have no control or use in scripts.

    Any ideas on how to make this script work again would be appreciated

    'Debt accounts array 11/2/00

    dim tbl as p
    dim t_accts as p
    dim t_companies as p

    dim NewPmarker as c

    tbl = table.current()
    t_accts = table.open("accounts")

    IF tbl.mode_get() " 0 THEN
    END
    END IF

    on error goto fix_error

    search:
    '------
    dim f_search as c
    dim compid as c
    dim x as n
    dim cbid as c
    dim who as c

    t_accts.index_primary_put("compname")
    t_accts.fetch_first()
    t_accts.fetch_find(clntid)

    count = calc-"no_accts
    s_num = count
    dim search(s_num) as c

    i = 0
    WHILE t_accts.client_id = clntid
    i = i + 1
    search(i) = left(t_accts.compname,15) +" - "+ remspecial(t_accts.acctnumber) +space(60)+ t_accts.pmarker
    t_accts.fetch_next(2)
    IF t_accts.fetch_eof()
    EXIT WHILE
    END IF
    END WHILE
    sort_array("search")
    t_accts.close()

    t_acct= table.get("accounts")

    continue:
    '--------
    ui_beep(64)
    found1 = ui_get_list_array("Client has "+str(s_num -1,3)+" accounts", 1, "search")
    IF found1 = "" THEN
    Debt_System_Browse.fetch_first()
    parent.resynch()
    ELSE
    found = clntid+left(found1,10)
    t_acct.index_primary_put("compname")
    t_acct.fetch_first()
    t_acct.fetch_find(found)
    Debt_System_Browse.activate()
    Debt_System_Browse.resynch()
    END IF
    t_acct.index_primary_put("client_id")

    END

    fix_error:
    '---------
    resume next
    David Montgomery

    #2
    RE: fetch_find in an embedded browse

    Hi David,

    In v6, arrays need square brackets not round ones. I do not know at what point that changed, but your arrays have round brackets so that may well be your problem. Either way, it's probably a good idea to fix them now anyway.

    Arrays are declared in the form...
    dim arrayname[number] as c
    ...and values are set...
    arrayname[n] = .....

    So looking through your code,
    dim search(s_num) as c
    should be
    dim search[s_num] as c

    ...and
    search[i] = left(t_accts.compname,15)......
    should be
    search[i] = left(t_accts.compname,15)......

    You will need to search the rest of your script for where arrays have been declared and their values have been set, and change the round brackets for square ones.

    Hopefully that'll have you off and running again.


    Regards,
    Trevor

    Comment


      #3
      RE: fetch_find in an embedded browse

      Thanks for your response. I made the corrections you suggested. Did not make any difference, the script works properly until

      t_acct.fetch_find(found)

      this function does not work in this script or other similar scripts.
      David Montgomery

      Comment


        #4
        RE: fetch_find in an embedded browse

        found = clntid+left(found1,10)

        for this to work, check the index and be sure that it exactly matches what you are sending it. Sounds like something is not right with the index
        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


          #5
          RE: fetch_find in an embedded browse

          I thought of that and have checked it. Remember, this worked for years before the new builds revoked the fact that child records could be controlled by indexes and now have to be controlled by queries.

          I'm stumped
          David Montgomery

          Comment


            #6
            RE: fetch_find in an embedded browse

            try this or a variaation:

            instead of t=table.get("table")

            t=Parentform:tables.tablename
            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


              #7
              RE: fetch_find in an embedded browse

              I'm not sure I understand.

              I did as you said

              t_acct = parentform:tables.accounts

              This didn't make any change

              I used the explorer to get the table name and got

              MDC_Debt_System:tables:accounts()

              I tried that and it didn't work either
              David Montgomery

              Comment


                #8
                RE: fetch_find in an embedded browse

                I could not get the fetch_find() function to work at all.

                But the following worked
                found = right(found1,45)
                t_acct.index_primary_put("pmarker")
                t_acct.fetch_first(1)
                while t_acct.pmarker "" found
                pmarker = t_acct.pmarker
                if t_acct.fetch_eof()
                exit while
                end if
                t_acct.fetch_next(1)
                end while
                Debt_System_Browse.refresh()

                I think the fetch_find() method has a bug as it does not work in any of my scripts now with the new build.
                David Montgomery

                Comment


                  #9
                  RE: fetch_find in an embedded browse

                  try this to see what is happening:

                  'to the following portion of your script
                  t_acct.fetch_first() 'unnecessary ********
                  rec=t_acct.fetch_find(found)
                  ui_msg_box("","" + rec) '***********
                  'if it found it, the rec will be greater than zero
                  Debt_System_Browse.activate()
                  Debt_System_Browse.resynch()
                  END IF

                  If rec is less than 0, the index/search variable don�t match
                  If the rec is greater than zero, you may need to modify the next lines:

                  t=parentform:tables:accounts �the browse table
                  t.order(�pmarker�,�pmarker=� + quote(found))
                  �accounts should have an index and a field named pmarker that match the value of variable-"found
                  Debt_System_Browse.refresh()

                  Regardless � modify the top of your script:
                  tbl = table.current()
                  IF tbl.mode_get() " 0 THEN
                  END
                  END IF
                  t_accts = table.open("accounts")
                  (otherwise you are leaving the table open!!)
                  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


                    #10
                    RE: fetch_find in an embedded browse

                    The variable found does match exactly an index called pmarker.

                    If I use t_acct = table.open("accounts") fetch_find(found) will find the record, but the browse will not refresh to the found record.

                    If I use t_acct = table.get("accounts") fetch_find(found) will not find the record.

                    but when I use the while method the script finds the record and refreshes the browse properly
                    David Montgomery

                    Comment

                    Working...
                    X