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

How do I make user select from table?

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

    How do I make user select from table?

    I am interested in aircraft, part of which means that I keep a diary of all the Identites I have seen.
    the plot so far.
    1)When I goto the "Auto Logging" form, I enter the date, place name and Identities and click on the "auto Logging" button.
    2)if a match is found on the master logfile and the matched record has the "AS" field empty, the date, where & Identity
    are written to that record.
    3)if no match the same search is done on the "Logback" file. if the logback match "AS" is blank the diary details are written to this file.
    4)If multiple matches are found on the master "Logfile", the problem I have is finding a way of asking me (the user) to choose either the correct one from the list OR indicate that none of then are correct.
    5)If a match record is chosen then we go back to 2) and/or 3).
    6)if no match is correct goto 3).

    Can anyone suggest a way of doing this.
    attached is a small Zip file with the neccessary files etc.

    TIA
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    RE: How do I make user select from table?

    I haven't looked at your zip file, but it would not be too tough to display multiple matching records using the

    ui_get_list_array() function

    The user could scroll through them and pick the one that fits...


    -- tom

    Comment


      #3
      RE: How do I make user select from table?

      Hi Tom,
      the problem with that command is that it only allows eight choices, which not be enough.
      Thanks for your input.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        RE: How do I make user select from table?

        Graham:

        I did a similar thing to select a customer name for a report. Here's what I did.......

        Created a form and imbedded a browse of the list from which to select. You could apply a query or index to this at init to get the records filtered or in the proper order.

        I have the user [using scroll bars or arrows] 'land' the highlight on the item desired. An O.K. button routine sets the [global] variable to the value of the selected line - then moves on in the script.

        This, of course can probably pick up only one value per event, but it might be something you haven't thought about.
        It works quite nicely for me resembling [somewhat] Alpha's 'picklist' utility 'out of the box'.

        Just a thought, and of course, you must realize I'm pretty new to this.

        Ken the Newbie

        Comment


          #5
          RE: How do I make user select from table?

          There are two related functions, only one of which is limited to 8 entries:

          ui_get_list()

          and

          ui_get_list_array()


          The latter is not so limited.

          -- tom

          Comment


            #6
            RE: How do I make user select from table?

            I DID look at your zip. Tom is right - get_list_array() is the way.

            I use it to pick assemblies in estimating and I have a list of over 40 assemblies and growing...Works beautifully.

            You might play with this code as a guide...

            ''''''''''''''''''''''''''''''''open asstc and set index to Assy

            loc = dir_get()
            tbl = Table.Open("assytc.dbf")
            indx = tbl.index_get("Assy1")
            tbl.index_primary_put(indx)
            num = indx.records_get()

            '''''''''''''''''''''''''''''''''create and fill array of Assemblies
            DIM listA (num) as C
            tbl.Fetch_First()
            FOR i = 1 TO num
            listA(i) = tbl.Assy+" "+tbl.Assitem
            tbl.Fetch_Next()
            NEXT i

            grp = ui_get_list_array("Select Assembly group",1,"listA")
            if grp = ""
            end
            end if
            Vassy = alltrim(substr(grp,1,12))
            Vassitem = alltrim(substr(grp,13,13))

            Comment


              #7
              RE: How do I make user select from table?

              Ok Guys,

              I went through each suggestion and finally settled on Ken's approach. I realised that I was after the recno() of the matching record so I read and re-read Chapter 22 in the XBasic Manual. After my hit-and-miss attempts I finally got it to work. What I now need to do is tidy up, I dont like having the same code spread around the same script, so if any of you can show me a tidier way to achieve the same please let me know:

              The Final Script (For those interested)

              ''XBasic
              dim logdiary as p
              dim logfile as p
              dim logback as p
              dim mindx as p
              dim bindx as p
              dim dindx as n
              dim global mrecno as n
              dim total_f as n
              dim total_b as n
              dim total_d as n
              dim global dupl as c
              dim global diary_date as d
              dim global diary_where as c
              total_f = 0
              total_b = 0
              total_d = 0
              if diary_date = {} .or. diary_where = "" then
              ui_msg_box("Date and/or Place Name Invalid","Please enter values and try again",UI_STOP_SYMBOL)
              goto done
              end if
              logdiary=table.open("logdiary")
              total_d=logdiary.records_get()
              if total_d = 0 then
              ui_msg_box("Nothing to Log!!","Please enter logging before clicking Auto Log button",UI_STOP_SYMBOL)
              goto done
              end if
              logfile=table.open("logfile")
              logback=table.open("logback")
              logfile.index_primary_put("Identity")
              logdiary.fetch_first()
              while .not. logdiary.fetch_eof()
              if logdiary.identity = "" then
              goto nextrec
              end if
              query.order="Identity"
              query.filter="Identity='"+logdiary.identity+"'"
              mindx=logfile.query_create()
              trace.writeln("MINDX="+ltrim(str(mindx.records_get()))+", IDENTITY="+trim(logdiary.identity))
              select
              case mindx.records_get() = 1
              '' Match found on logfile
              if ut(logfile.as) = "" then
              total_f = total_f + 1
              logfile.change_begin()
              logfile.as = logdiary.identity
              logfile.identity = logdiary.identity
              logfile.where = diary_where
              logfile.when = diary_date
              logfile.change_end(.t.)
              mindx.drop()
              end if
              case mindx.records_get() = 0
              '' no match found on logfile
              query.order="Identity"
              query.filter="Identity='"+logdiary.identity+"'"
              bindx=logback.query_create()
              if bindx.records_get() = 0 then
              '' No match found on logback
              total_b = total_b + 1
              logback.enter_begin()
              logback.identity = upper(logdiary.identity)
              logback.as = upper(logdiary.identity)
              logback.when = diary_date
              logback.where = upper(diary_where)
              logback.enter_end(.t.)
              bindx.drop()
              end if
              case mindx.records_get() > 1
              '' duplicate matches found on logfile
              if is_object("Logfile_Browse") then
              Logfile Browse.show()
              Logfile Browse.activate()
              else
              :Form.view("Logfile_Browse","Dialog")
              end if
              last_button = :Logfile_browse.last_pressed()
              select
              case last_button = "BUTTON1"
              mrecno = :Logfile_browse:mr.value
              :logfile_browse.close()
              logfile.index_primary_put()
              logfile.fetch_find(mrecno)
              if ut(logfile.as) = "" then
              total_f = total_f + 1
              logfile.change_begin()
              logfile.as = upper(logdiary.identity)
              logfile.identity = upper(logdiary.identity)
              logfile.where = diary_where
              logfile.when = diary_date
              logfile.change_end(.t.)
              mindx.drop()
              end if
              case last_button = "BUTTON2"
              ''No match found in Dupl List
              :logfile_browse.close()
              query.order="Identity"query.filter="Identity='"+logdiary.identity+"'"
              bindx=logback.query_create()
              if bindx.records_get() = 0 then
              '' No match found on logback
              total_b = total_b + 1
              logback.enter_begin()
              logback.identity = upper(logdiary.identity)
              logback.as = upper(logdiary.identity)
              logback.when = diary_date
              logback.where = diary_where
              logback.enter_end(.t.)
              bindx.drop()
              end if
              end select
              end select
              nextrec:
              logdiary.fetch_next()
              end while
              if total_f + total_b > 0 then
              ui_msg_box("Auto Logging",ltrim(str(total_d))+" entered into Logdiary, "+ltrim(str(total_f))+" logged in Logfile and "+ltrim(str(total_b))+" logged in logback .")
              end if
              done:
              END
              --
              Support your local Search and Rescue Unit, Get Lost!

              www.westrowops.co.uk

              Comment

              Working...
              X