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

Update table

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

    Update table

    Hello.

    I have a dialog component with two dropdown lists (Approval_No which is multiselect and Collection_No).

    In the AfterValidate Event i am attempting to take the values selected from the 'Approval_No' and 'Collection_No' dropdowns and place it in the 'assets' table.

    The way this works is, you select one or many approval numbers from the multiselect dropdown and then select a collection no. The collection no will be inserted in the selected records matching the approval no(s) selected.

    Code:
    Dim tbl as P
    tbl = table.open("assets")
    [B]query.filter = "Approval_No =" crlf_to_comma(approvalNumber.dump())""[/B]
    query.order = ""
    query.options = ""
    indx = tbl.query_create()
    update.fields = 1
    update.field1 = "Collection_No"
    [B]update.expr1 = Collection_No[/B]
    tbl.update()
    I think my problem is how i am refering to the dropdown list box in both (BOLD) sections of the code.

    Can anyone please advise me how to fix this.

    Denis
    Last edited by den1s; 09-28-2006, 06:42 AM. Reason: update

    #2
    Re: Update table

    BUMP - Anyone?

    Comment


      #3
      Re: Update table

      Denis

      I think you have pinpointed the line of code that is causing the problem.

      The best way that I have found to debug these issues is to use the a5_show_variable() command. This will show what is in the variables and you can see exactly what is happening to a variable as you move through the code.

      Don't forget to remove them when you have it debugged.... ;)

      ps - since you have a multi select, you'll need to deal with the translation to the filter in another manner. Use of a *for_each() to build the expression for query.filter is one technique to use...
      Al Buchholz
      Bookwood Systems, LTD
      Weekly QReportBuilder Webinars Thursday 1 pm CST

      Occam's Razor - KISS
      Normalize till it hurts - De-normalize till it works.
      Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
      When we triage a problem it is much easier to read sample systems than to read a mind.
      "Make it as simple as possible, but not simpler."
      Albert Einstein

      http://www.iadn.com/images/media/iadn_member.png

      Comment


        #4
        Re: Update table

        Thanks for the tip Al.

        I am a real beginner with xbasic and am learning as i go along. Do you have an example how i may refer to my dropdown control field (Collection_No) in this line of code?

        Code:
        update.expr1 =

        Comment


          #5
          Re: Update table

          Your problem is a common one. For a multiselect, your filter will be built as

          approval_No=num1 .or. num2 .or. num3.....

          but you want it to read
          Approval_No=num1 .or. Approval_No=num2 .or. ....

          So as Art says, you need the for each. The following is based on an example in one of the example pages

          vFilter = approvalNumber.dump()
          if vFilter=""
          end
          end if
          vFilter = *for_each(x,"Approval_No = " + quote(x),vFilter)
          vFilter = strtran(alltrim(vFilter), crlf()," .or. ")

          Pat
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Re: Update table

            Thanks Pat and Al.

            I have amended my code, but it appears that all records in the table are being updated. I cant see the obvious mistake in the filter code.

            What do you make of it?

            Code:
            tbl = table.open("assets")
            'Define a query so that only selected records are updated.
            vFilter = approvalNumber.dump()
            vFilter = *for_each(x,"Approval_No = " + quote(x),vFilter)
            vFilter = strtran(alltrim(vFilter), crlf()," .or. ")
            indx = tbl.query_create()
            update.fields = 3
            update.field1 = "Collection_No"
            update.expr1 = time("ddmmyy0h0m0s")
            update.field2 = "Company"
            update.expr2 = "'Company'"
            update.field3 = "Collect_PO_Number"
            update.expr3 = "'PO_Number'"
            tbl.update()
            The reason i have put a text entry in the update.exp2 and expr3 is because i dont know how to refer to the dropdown controls (Company/PO_Number) in my dialog component. So frustrating!

            Code:
            update.field2 = "Company"
            update.expr2 = "'Company'"
            update.field3 = "Collect_PO_Number"
            update.expr3 = "'PO_Number'"

            Comment


              #7
              Re: Update table

              I don't see an a5_show_variable()....
              Al Buchholz
              Bookwood Systems, LTD
              Weekly QReportBuilder Webinars Thursday 1 pm CST

              Occam's Razor - KISS
              Normalize till it hurts - De-normalize till it works.
              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
              When we triage a problem it is much easier to read sample systems than to read a mind.
              "Make it as simple as possible, but not simpler."
              Albert Einstein

              http://www.iadn.com/images/media/iadn_member.png

              Comment


                #8
                Re: Update table

                Where would i put the show variable command? Sorry Al, i have never used this before. What variable show i be monitoring?

                Comment


                  #9
                  Re: Update table

                  Originally posted by den1s View Post
                  Thanks Pat and Al.

                  I have amended my code, but it appears that all records in the table are being updated. I cant see the obvious mistake in the filter code.

                  What do you make of it?

                  Code:
                  tbl = table.open("assets")
                  'Define a query so that only selected records are updated.
                  vFilter = approvalNumber.dump()
                  vFilter = *for_each(x,"Approval_No = " + quote(x),vFilter)
                  vFilter = strtran(alltrim(vFilter), crlf()," .or. ")
                  [COLOR=Red]a5_show_variable(vFilter)
                  query.filter=vFilter
                  [/COLOR] indx = tbl.query_create()
                  update.fields = 3
                  update.field1 = "Collection_No"
                  update.expr1 = time("ddmmyy0h0m0s")
                  update.field2 = "Company"
                  update.expr2 = "'Company'"
                  update.field3 = "Collect_PO_Number"
                  update.expr3 = "'PO_Number'"
                  tbl.update()
                  The reason i have put a text entry in the update.exp2 and expr3 is because i dont know how to refer to the dropdown controls (Company/PO_Number) in my dialog component. So frustrating!

                  Code:
                  update.field2 = "Company"
                  update.expr2 = "'Company'"
                  update.field3 = "Collect_PO_Number"
                  update.expr3 = "'PO_Number'"
                  Note the 2 lines in red.

                  What are the variable names for the dropdown controls (Company/PO_Number) in your dialog component?
                  Al Buchholz
                  Bookwood Systems, LTD
                  Weekly QReportBuilder Webinars Thursday 1 pm CST

                  Occam's Razor - KISS
                  Normalize till it hurts - De-normalize till it works.
                  Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                  When we triage a problem it is much easier to read sample systems than to read a mind.
                  "Make it as simple as possible, but not simpler."
                  Albert Einstein

                  http://www.iadn.com/images/media/iadn_member.png

                  Comment


                    #10
                    Re: Update table

                    Thanks Al, Yes. They are Company and PO_Number.

                    I cut and pasted your amended code and the strangest thing happened.

                    I selected one approval_no, when i pressed submit, only that record is now in the table, all other entries are erased, and what make this even more wierd, the values in the dropdown still show the approval numbers for all records.

                    Comment


                      #11
                      Re: Update table

                      Originally posted by Al Buchholz View Post
                      I don't see an a5_show_variable()....
                      Al, you can't use a5_show_variable() in a web app. It is a desktop UI command that has no meaning in the context of a web page or component.

                      Lenny Forziati
                      Vice President, Internet Products and Technical Services
                      Alpha Software Corporation

                      Comment


                        #12
                        Re: Update table

                        Denis

                        The records are not erased, they are filtered out.

                        With the form open, do a control-I and change the index that is being used...

                        I'd suggest using vCompany and vPO_number as variables names in the dialog and then use those variables in the expressions.. (they should be dimmed SHARED)

                        update.expr2 = vCompany
                        .
                        .
                        update.expr3 = vPO_Number
                        Al Buchholz
                        Bookwood Systems, LTD
                        Weekly QReportBuilder Webinars Thursday 1 pm CST

                        Occam's Razor - KISS
                        Normalize till it hurts - De-normalize till it works.
                        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                        When we triage a problem it is much easier to read sample systems than to read a mind.
                        "Make it as simple as possible, but not simpler."
                        Albert Einstein

                        http://www.iadn.com/images/media/iadn_member.png

                        Comment


                          #13
                          Re: Update table

                          Originally posted by Lenny Forziati View Post
                          Al, you can't use a5_show_variable() in a web app. It is a desktop UI command that has no meaning in the context of a web page or component.

                          Oops missed that we're in the web app forum....

                          So he'd have to work this out as a script or function in the desktop model and then apply that code to the web page...
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #14
                            Re: Update table

                            Al,

                            I have just looked up the dimmed SHARED and it's also a desktop function.

                            I appreciate your help in trying to get this resolved.

                            Denis

                            Comment


                              #15
                              Re: Update table

                              Denis,

                              Actually, on the web, you don't dim variables as shared.

                              If you have a dropdown box set as single and you want to refer to the value in the script, then you refer to it using the name you gave the control when you created it. The name defaults to something like "dropdown1", but you probably changed that. Look in Control Settings -> Name

                              You can leave the scope as local.

                              As you have seen, if the scope is multiselect, then the control becomes an array.

                              Pat
                              Pat Bremkamp
                              MindKicks Consulting

                              Comment

                              Working...
                              X