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

Need to return to same form after query returns 0 recs

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

    #31
    But - hey! The darned thing works, now - do I want to fix what 'ain't broken? My daddy always said NO.

    Okay - if you insist...here is the final code that works:

    'Date Created: 23-May-2006 10:40:48 AM
    'Last Updated: 24-May-2006 08:34:36 AM
    'Created By : tuckerw
    'Updated By : tuckerw
    'Are there matching records present in the table?
    dim global tbl as P
    dim global qry as P
    dim global nrecs as N

    tbl = table.open("sites")

    query.description = "Search for matching records"
    query.order = ""
    query.filter = "trim(Sites->Equake)=\"Y\""
    query.options = ""
    nrecs= a5_get_records_in_query("sites","equake=\"Y\"")

    IF (nrecs = 0) then
    qry.drop()
    ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
    tbl.close()
    end 'If there are no matching records, script ends here

    else
    'Close Quick Screen
    DIM mode as c
    mode = parentform.mode_get()
    'If the form is in Enter or Change mode, first save the changes before closing the form
    if mode = "ENTER" .or. mode = "CHANGE" then
    parentform.commit()
    'Check to see if the record was successfully saved
    if parentform.mode_get()<>"VIEW" then
    ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
    end
    end if
    end if
    'Close the form
    parentform.close(.f.)

    'Opens sites and runs saved query on Equate
    query.filter = "trim(Sites->Equake)=\"Y\""
    query.order = ""


    'Open the layout_type showing just the records that satisfy the filter
    DIM Shared varP_Sites as P
    DIM layout_name as c
    layout_name = "Sites"


    dim tempP as p
    'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
    tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
    'Test if pointer is valid
    if is_object(tempP) then
    'Test if pointer refers to a form or browse
    if tempP.class() = "form" .or. tempP.class() = "browse" then
    'Apply the query to the form or browse as the Base query. (this means that
    'the user cannot turn the query off, only add to the query)
    tempP.BaseQueryRun(query.filter,query.order)
    'then activate the already open window
    tempP.activate()
    else
    'Window is not already open, so open it
    varP_Sites = :Form.viewqueried(layout_name,query.filter, query.order )

    end if
    else
    varP_Sites_Plus = :Form.viewqueried(layout_name,query.filter, query.order )

    end if
    xbasic_wait_for_idle()
    tbl.close()
    end if

    Now, if someone can figure out how to "nest" the queries - I'd be elated...

    Thank you,
    Wanda

    Comment


      #32
      You can leave it alone (no harm anywhere) or you can use the code below. Lines shown in red with '--------------- can be deleted because nrecs= a5_get_records_in_query("sites","equake=\"Y\"") does all that.

      Code:
      'Date Created: 23-May-2006 10:40:48 AM
      'Last Updated: 24-May-2006 08:34:36 AM
      'Created By : tuckerw
      'Updated By : tuckerw
      'Are there matching records present in the table?
      [COLOR="red"]'--------------dim global tbl as P
      '--------------dim global qry as P[/COLOR]
      dim global nrecs as N
      
      [COLOR="Red"]'----------tbl = table.open("sites")[/COLOR]
      
      [COLOR="red"]'----------query.description = "Search for matching records"[/COLOR]
      [COLOR="red"]'----------query.order = ""[/COLOR]
      [COLOR="red"]'----------query.filter = "trim(Sites->Equake)=\"Y\""[/COLOR]
      [COLOR="red"]'----------query.options = ""[/COLOR]
      nrecs= a5_get_records_in_query("sites","equake=\"Y\"")
      
      IF (nrecs = 0) then
      [COLOR="red"]'----------qry.drop()[/COLOR]
      ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
      [COLOR="red"]'----------tbl.close()[/COLOR]
      end 'If there are no matching records, script ends here
      
      else
      'Close Quick Screen
      DIM mode as c
      mode = parentform.mode_get()
      'If the form is in Enter or Change mode, first save the changes before closing the form
      if mode = "ENTER" .or. mode = "CHANGE" then
      parentform.commit()
      'Check to see if the record was successfully saved
      if parentform.mode_get()<>"VIEW" then
      ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
      end
      end if
      end if
      'Close the form
      parentform.close(.f.)
      
      'Opens sites and runs saved query on Equate
      query.filter = "trim(Sites->Equake)=\"Y\""
      query.order = ""
      
      
      'Open the layout_type showing just the records that satisfy the filter
      DIM Shared varP_Sites as P
      DIM layout_name as c 
      layout_name = "Sites"
      
      
      dim tempP as p
      'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
      tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
      'Test if pointer is valid
      if is_object(tempP) then 
      'Test if pointer refers to a form or browse
      if tempP.class() = "form" .or. tempP.class() = "browse" then 
      'Apply the query to the form or browse as the Base query. (this means that 
      'the user cannot turn the query off, only add to the query)
      tempP.BaseQueryRun(query.filter,query.order)
      'then activate the already open window
      tempP.activate()
      else
      'Window is not already open, so open it
      varP_Sites = :Form.viewqueried(layout_name,query.filter, query.order )
      
      end if
      else 
      varP_Sites_Plus = :Form.viewqueried(layout_name,query.filter, query.order )
      
      end if
      xbasic_wait_for_idle()
      tbl.close()
      end if
      There can be only one.

      Comment


        #33
        Wanda,

        Stan is correct. You apparently combined my code with Mike's so you have a lot of unneccessary lines. I would follow his suggestion, yes there is no harm by leaving it, but if you are beginning your lessons in coding, no reason to include code that is not needed :)
        Cheryl
        #1 Designs By Pagecrazy
        http://pagecrazy.com/

        Comment


          #34
          Originally posted by Cheryl Lemire
          Wanda,

          Stan is correct. You apparently combined my code with Mike's so you have a lot of unneccessary lines. I would follow his suggestion, yes there is no harm by leaving it, but if you are beginning your lessons in coding, no reason to include code that is not needed :)
          Plus if the unnecessary code is left in and you try to use it later in constructing another script, you could well get confused. The portion

          Code:
          'Are there matching records present in the table?
          dim global nrecs as N
          nrecs= a5_get_records_in_query("sites","equake=\"Y\"")
          IF (nrecs = 0) then
          ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
          end 'If there are no matching records, script ends here
          else
          'other code here as in your current script
          end if
          can be used anywhere you want to test for records fitting a query, such as before a report is run, etc. All you have to do is alter the

          nrecs= a5_get_records_in_query("sites","equake=\"Y\"")

          by substituting a different table name and a different filter.
          There can be only one.

          Comment


            #35
            Okay, Stan, this is what drives me nuts! I spent 20 minutes or so trying to decipher the code in your sample - key word is "trying". Apparently, code is pretty self explanatory to most people - but not at all to me. Maybe I can get a bit of it - sort of like the blind "seeing only the tail of an elephant and thinking it's a snake".

            Originally posted by Stan Mathews
            Just when you have time or decide to delve further. Pretty self explanatory in usage. Code behind buttons is heavily commented.
            Here is the code on a button from the example you sent:

            'Date Created: 24-May-2006 09:07:58 AM
            'Last Updated: 24-May-2006 09:47:50 AM
            'Created By : Stan Mathews
            'Updated By : Stan Mathews
            tbl = table.open("data_table",FILE_RW_SHARED) ' open table with pointer variable tbl
            IF var->alogical = .t. ' set up filter to choose records
            query.filter = "deceased" ' special handling of logical comparison
            ELSE
            query.filter = ".not. deceased"
            END IF
            query.order = "deceased" ' set up order to display records if any found
            query.options = "I" ' not strictly required but suggested by documentation
            query.description = "Temp Deceased" ' just for info
            ix = tbl.query_create() ' create query with pointer ix
            recs = ix.records_get() ' use .records_get() method to get record count
            if recs = 0 ' if we didn't find any records
            ui_msg_box("Sorry","No entries found for deceased "+ var->alogical ) ' do the code inside the if ... end if
            ix.drop() ' get rid of useless query
            tbl.close() ' close table
            end ' then stop

            end if
            tbl.close() ' close table

            'any other code you wanted to run if there were records would go down here like .....
            'same for all four buttons

            DIM Shared varP_Saved_Browse as P
            DIM layout_name as c
            layout_name = "Saved Browse" 'just the name I saved the browse as
            DIM tempP as p
            'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
            tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
            'Test if pointer is valid
            if is_object(tempP) then
            'Test if pointer refers to a form or browse
            if tempP.class() = "form" .or. tempP.class() = "browse" then
            'If so, then activate the already open window
            tempP.activate()

            else
            'Window is not already open, so open it
            varP_Saved_Browse = :Browse.view(layout_name)


            end if
            else
            varP_Saved_Browse = :Browse.view(layout_name)


            end if

            ix.drop() ' get rid of query after it has been used

            My wonderment is in several areas, such as line 5...what is FILE_RW_SHARED?

            Line 7 indicates that the query is named "deceased", yet line 12 indicates that the description of the query is "Temp Deceased". My wonderment is, which is it - deceased or temp deceased? Or, maybe there are two queries in this code?

            Line 13 - What's an ix pointer and why is it needed? If I use the ix pointer in the code I'm really trying to get ironed out, will that handle nesting queries?

            Line 23 - what is meant by, "In case layout_name is qualified with a dictionary name..." Huh?

            Line 24 - What does the @ symbol do, and what does the ,1, mean prior to the ending@?

            Towards the end, reference is made the VarP_Saved_Browse...if the browse is saved, then why is a variable needed? My only use of variables is when the variable returns some sort of temporary data.

            See? It's more greek than not to me. See why I hate code? What's a person to do, eh, when they simply don't get it, in spite of hours and hours and hours over the years trying to figure the language out.

            The coding needed for the first computer I ever worked on - a TRS80 (remember the Trash 80?) made more sense than XBasic to me. I'm not dogging Alpha, because I know that 99.9999999% of Alpha developers actually "get" code language. But I don't.

            I'm ready to give up and accept it, just about.

            W

            Comment


              #36
              Originally posted by Stan Mathews
              Plus if the unnecessary code is left in and you try to use it later in constructing another script, you could well get confused. The portion
              To my knowledge I didn't combine them - but who knows? And I don't dare start chopping away at it - it'd be the next century before I can get it to work again...even with all this instruction I'm getting.

              All I need to know now is how to nest the queries...but I'm not going to sweat it if I don't. The user will just have to learn how to use the filter button within the Sites form. I figure it's much easier to teach a user what the filter button does than to waste county dollars on trying to understand a piece of code.

              In fact, I'm very sorry to waste your and Stan and Mike's time on this, as well...just a bit more and I'll be done (nesting the queries).

              Many thanks,
              Wanda

              Comment


                #37
                Originally posted by Wanda Tucker
                My wonderment is in several areas, such as line 5...what is FILE_RW_SHARED?
                a mode of opening the table, options are available for FILE_ReadWrite_SHARED, FILE_Read_Only_SHARED, etc. The option chosen is probably best for a multi user environment unless you know you need EXCLUSIVE access.

                Line 7 indicates that the query is named "deceased", yet line 12 indicates that the description of the query is "Temp Deceased". My wonderment is, which is it - deceased or temp deceased? Or, maybe there are two queries in this code?
                Line 7 indicates that the filter for the query is "deceased", the description is a different thing.

                Line 13 - What's an ix pointer and why is it needed? If I use the ix pointer in the code I'm really trying to get ironed out, will that handle nesting queries?
                - When you establish a pointer variable with ix = tbl.query_create() you can then use the methods available for the pointer like .records_get(). As an analogy, the ix pointer variable is like a food processor. You can plug in whatever tools (methods) that you have that work with the food processor, shredder, slicer, dicer, crusher, whatever.

                Line 23 - what is meant by, "In case layout_name is qualified with a dictionary name..." Huh?
                the code that opens the browse is a direct copy of the xbasic revealed when you create an action script to open a browse, reusing an existing instance if there is one (not previously closed and maybe not visible) If you know the browse you want to open is the only one with a certain name and you know it has been previously closed, all you really need is

                :Browse.view(layout_name)

                where layout_name is the browse you want to open, quoted, inside the parentheses.

                Line 24 - What does the @ symbol do, and what does the ,1, mean prior to the ending@?
                when examining anything unfamiliar, start with the inner portions first instead of trying to understand it in the context of the whole line. In this use the Output_String as C = WORD( Input_String as C, Word_Number as N [, Word_Delimiter as C [, Word_Count as N ]] ) function is used to return the first word in layout_name where the divider is "@"

                word(layout_name,1,"@"))

                You could have browses named "test" for tables named "sites" and "people". The fully qualified names of these two browses would be "[email protected]" and "[email protected]"

                The word function returns the portion "test".
                Towards the end, reference is made the VarP_Saved_Browse...if the browse is saved, then why is a variable needed? My only use of variables is when the variable returns some sort of temporary data.
                same comment, if you know you have unquely named browses and that they are not already opened, then just use the line :Browse.view(layout_name) with your browse name.
                There can be only one.

                Comment


                  #38
                  Originally posted by Wanda Tucker
                  To my knowledge I didn't combine them - but who knows? And I don't dare start chopping away at it - it'd be the next century before I can get it to work again...even with all this instruction I'm getting.

                  All I need to know now is how to nest the queries...but I'm not going to sweat it if I don't. The user will just have to learn how to use the filter button within the Sites form. I figure it's much easier to teach a user what the filter button does than to waste county dollars on trying to understand a piece of code.

                  In fact, I'm very sorry to waste your and Stan and Mike's time on this, as well...just a bit more and I'll be done (nesting the queries).

                  Many thanks,
                  Wanda
                  I thought you found your answer about nesting the queries in the other thread when you noted something about having to have the query button(s) on a form not based on the table/set being queried.

                  Most developers use menu forms based on tables created specifically for the purpose of not opening data tables just to let a user push a button. Take a look at Menu forms and look at the table behind the main menu in AlphaSports.
                  Last edited by Stan Mathews; 05-24-2006, 01:13 PM.
                  There can be only one.

                  Comment


                    #39
                    Dang, you guys just won't give up on me! I'm humbled. Will mull over your explanations and maybe I'll see a little flicker of light. :)
                    W

                    Comment


                      #40
                      Originally posted by Stan Mathews
                      I thought you found your answer about nesting the queries in the other thread when you noted something about having to have the query button(s) on a form not based on the table/set being queried.
                      I did. But the next day it didn't behave the same, so I'm back at the beginning of that idea/need.
                      W

                      Comment


                        #41
                        Originally posted by Wanda Tucker
                        Dang, you guys just won't give up on me! I'm humbled. Will mull over your explanations and maybe I'll see a little flicker of light. :)
                        W
                        For example you could have this code for a button, anywhere in your application.

                        Code:
                        'Are there matching records present in the table?
                        dim global nrecs as N
                        nrecs= a5_get_records_in_query("sites","equake=\"Y\"")
                        IF (nrecs = 0) then
                        ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
                        end 'If there are no matching records, script ends here
                        'no point in opening an empty browse
                        else
                        'otherwise we do have records to show so ......
                        layout_name = "the actual name of browse you want to open"
                        :Browse.viewqueried(layout_name,"equake=\"Y\"") 
                        end if
                        Last edited by Stan Mathews; 05-24-2006, 02:18 PM. Reason: changed browse.view to browse.viewqueried and filter added
                        There can be only one.

                        Comment


                          #42
                          I would like to take this time to thank Wanda, Mike, and Stan for this thread. As a result I was able to modify my function to just a few lines. I don't use an 'else' in my function though, I simply end it if nrecs=0. Since I call my function in an 'event' somewhere on a form, if I need 'something' else to happen, I code that portion in the event itself after calling my function. Here is my revised function:

                          Code:
                          FUNCTION matching_records AS C (table_name AS C, filter_name AS C)
                              
                          '-------------------------------------------------------------------------------
                          ' matching_records() function created by CKL 05/14/2006
                          '-------------------------------------------------------------------------------
                          
                          '*******************************************************************************
                          ' PRIMARY PURPOSE of the matching_records() function is to verify that there
                          ' are matchibg records in a table based on the parameters.
                          '
                          ' Parameters:
                          '
                          ' matching_records("table_name", "filter_name")
                          '    table_name    -    sets the table/set to query
                          '    filter_name    -    sets the filter
                          
                          ' ADDITIONAL FEATURES
                          ' - If no matching records are found, the user receives a message box and the
                          '    script ends.
                          
                          ' REVISIONS
                          ' 20060524 CKL
                          '    - Modify to use alpha built in function a5_get_records_in_query()
                          '    - Remove order_name parameter, no longer needed with built in function
                          '*******************************************************************************
                          
                          'Are there matching records present in the table?
                          dim global nrecs as N
                          nrecs= a5_get_records_in_query(table_name,filter_name)    'returns the number of records in the specified table or set that satisfy a query expression.
                          IF (nrecs = 0) then
                          ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
                          end 'If there are no matching records, script ends here
                          end if
                          xbasic_wait_for_idle()
                              
                          END FUNCTION
                          An example of how I use the above: I have a script that displays a dialog showing a po number and a ship date, when the user clicks the ok button - I check to see if the po number exists, if it does not ... the script ends, if it does exist, my script continues as follows:

                          Code:
                          '=======================================================================
                          
                          'Are there matching records present in the table?
                          matching_records("nceinvn", "nceinvn->nce_p_o_ = Var->vcgNCEPO")    '20060524 CKL removed order_name parameter
                          
                          IF (nrecs = 0) then
                              parentform:b_update.activate()
                              end     'If there are no matching records, script ends here
                          end if
                          
                          xbasic_wait_for_idle()
                           
                          'get here only if the search returned matching records in the table
                          
                          '=======================================================================
                          Wanda, you made a comment earlier in the thread:
                          How do you whizzes create code this quickly?!
                          I can't speak for other developers, but I am not a whiz, nor do I create code quickly. If you see me posting code samples, it is because I have used them in the past.

                          I have spent hours trying to get code to work and do what I want in the end. The fact that I take the time to read the help docs and ask for help here on the forum is what has allowed me to learn what I have so far. If I did not spend hours trying all possible scenarios in my code prior to asking for help, I probably would not understand it as well.

                          There is still code that I use that I do not fully understand, but I understand enough of it to know what can be changed to get the desired results. And when I don't, I come here :)
                          Cheryl
                          #1 Designs By Pagecrazy
                          http://pagecrazy.com/

                          Comment


                            #43
                            Originally posted by Stan Mathews
                            For example you could have this code for a button, anywhere in your application.

                            Code:
                            'Are there matching records present in the table?
                            dim global nrecs as N
                            nrecs= a5_get_records_in_query("sites","equake=\"Y\"")
                            IF (nrecs = 0) then
                            ui_msg_box("Null Query","There are no matching records in this search, unable to proceed" ,UI_INFORMATION_SYMBOL)
                            end 'If there are no matching records, script ends here
                            'no point in opening an empty browse
                            else
                            'otherwise we do have records to show so ......
                            layout_name = "the actual name of browse you want to open"
                            :Browse.view(layout_name) 
                            end if
                            Now, that makes sense! Maybe code is sort of like algebra to some people...struggle, struggle, don't get it for weeks/months, then all of a sudden something clicks (no pun intended). :)

                            So, I take it that this code is simply for running a saved query, then opening the browse to show the records in the query, or, not opening the browse when no records are found by the query. Right?

                            Comment


                              #44
                              Originally posted by Wanda Tucker
                              Now, that makes sense! Maybe code is sort of like algebra to some people...struggle, struggle, don't get it for weeks/months, then all of a sudden something clicks (no pun intended). :)

                              So, I take it that this code is simply for running a saved query, then opening the browse to show the records in the query, or, not opening the browse when no records are found by the query. Right?
                              Almost. The line

                              nrecs= a5_get_records_in_query("sites","equake=\"Y\"")

                              queries the sites table filtering for equake = "Y"

                              No saved query involved. It displays a specified browse showing the results of the query only if there are records that satisfy equake = "Y".

                              Now consider a form where you have created a variable, say yesorno and displayed it on the form. The user can enter "Y" or "N" or any other letter.

                              You change the nrecs= a5_get_records_in_query("sites","equake=\"Y\"")

                              to

                              nrecs= a5_get_records_in_query("sites","equake="+quote(var->yesorno))

                              If the user enters Y in the variable on the form, they get shown the browse containing records where equake="Y". It the user enters N, they get shown the browse containing records where equake="N". If they enter any other letter, assuming there are only Y and N in the table field equake, they get the message in the ui_msg_box().
                              There can be only one.

                              Comment


                                #45
                                [QUOTE=
                                I can't speak for other developers, but I am not a whiz, nor do I create code quickly. If you see me posting code samples, it is because I have used them in the past.

                                I have spent hours trying to get code to work and do what I want in the end. The fact that I take the time to read the help docs and ask for help here on the forum is what has allowed me to learn what I have so far. If I did not spend hours trying all possible scenarios in my code prior to asking for help, I probably would not understand it as well.

                                There is still code that I use that I do not fully understand, but I understand enough of it to know what can be changed to get the desired results. And when I don't, I come here :)[/QUOTE]

                                Most of my hours are spent learning and using the incredible Action Scripting. The Help files, I find confusing most of the time, to be honest. With code, I'd enjoy spending time, but don't have the time to spend, unfortunately - like adding my hours up this week just to get one button to work (which still doesn't nest queries) by way of code, comes to about 10 - 12 hours. I'd get nothing else done, and still need to spend hundreds of hours on any other code I might need. So, there you have it. It's like doing laundry in a river that takes all day - or using an automatic washer that takes about 45 minutes. If you can't afford all day, time-wise, then the washer is a wonderful tool. The trade-off is that you know how the clothes get clean at the river - but have no clue how a washer works, yet it works better and faster.

                                Given tons of unexpecteds to deal with at my new retail store (like the database developer quitting on me in mid-stream, and dealing with inventory suppliers who don't ship what you order, yet charge you for returning the goods...blah, blah, blah...) my stress level has been exceptionally high, lowering my tolerance level.

                                I'm done for the day. Thank you!\
                                Wanda

                                Comment

                                Working...
                                X