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

Menu creation - I'm a novice

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

    Menu creation - I'm a novice

    Hello,

    I've created my first menu (via a form) and want to add an item that will select, for viewing in a browse/and/or form, only records that were entered on a particular date. That date will be in a variable. I've written the variable in the Code Editor, but don't know how to write the code to make the whole process work for this button.

    Can someone tell me in a very simplified way, please?

    Thanks,
    Wanda

    #2
    RE: Menu creation - I'm a novice

    Wanda,

    The answer can be found in the xbasic manual in the section on xbasic methods for working with forms. The section to read is .query_run(). The only tricky part is getting the filter expression correct. If the variable you are using for the search date is a character field (probably the easiest method), the following should work. First, assume the variable name is "date_find", the table is called "mytable" and the date field in the table is "tbl_date".

    parentform:tables:mytable.filter_expression = "tbl_date={"+date_find+"}"
    parentform:tables:mytable.query()

    Jerry

    Comment


      #3
      RE: Menu creation - I'm a novice

      Thanks, Jerry. I will try it out here in a few minutes, and let you know if I run into any snags. I appreciate it :)

      Comment


        #4
        RE: Menu creation - I'm a novice

        No dice, Jerry. First, I don't want to query by form. Rather, I want to query by table. That said, I wrote the script, replacing "parentform" with "parentbrowse". Granted, it was a longshot.

        Any other suggestions?

        Thanks!
        Wanda

        Comment


          #5
          RE: Menu creation - I'm a novice

          Wanda,
          The examples in the xbasic manual use three different methods. Only the first is uses query by form. The second (the one my script example uses) sets the base filter for the form. The third just queries the form and returns records that fit the query. Also, my script was for a form, not a browse. If you wanted to filter a browse on a form, you would need

          formname:browsename:Tables:tablename.filter_expression = yourexpression

          You could substitute parentform or topparent for the formname. Check the section on absolute and relative object addresses for more information. Parentbrowse is not an allowable address.

          Don't feel bad. I still get confused with proper object address syntax. The section on setting filters and running queries is also not real clear until you experiment and see how they work.

          One way to help clear up the confusion would be to create a query from the query genie, turn on the script recorder and see how the code is created. First go to the operations tab and select new. Use the query genie to create a query. Before running it, go to the a5 menu and select view, script recorder window. When the window opens, click options and select low level xbasic commands. Click ok and click on the recording box to turn the recorder on. Now run the query. The complete script will show in the recorder window. You can save the lines to a script or cut and paste into an existing script.

          Jerry

          Comment


            #6
            RE: Menu creation - I'm a novice

            Duh,

            Just reread your first post. I think what you want is to run a query when you open a form or whatever and show the results. Look under form.load() for two examples. You can cut and paste the code, change the names to the name of you form, and change the filter expression. The syntax for the filter expression is still the same as my example.

            If you run a query from the operations tab, the code created by the genie normally opens the default browse, so using the script recorder is another method to get the code.

            If this still doesn't make sense, post your form, table, and variable names and someone can probably create the correct code.

            Jerry

            Comment


              #7
              RE: Menu creation - I'm a novice

              Thank you so much, Jerry, for your time and willingness to help. I won't be able to work on this again until this afternoon (hopefully!), as other pressing projects loom before me.

              I will update you when I get back to it.

              Thanks again!
              Wanda

              Comment


                #8
                RE: Menu creation - I'm a novice

                Wanda,

                Like you, I am new to ver 4, but I have written much in earlier versions. I was testing with one of the tables we are converting and using action scripting, I came up with this little snippet which seems to work.

                '**************************************************
                DIM layout_ptr as P
                DIM PROGRAM AS c
                ' This sets the value of your variable
                program = ui_get_text("ENTER VALUE","Program","GA ")

                'setup which browse you want
                layout_ptr = :Browse.load("Case View")

                'define the filtering based on the vaiable
                layout_ptr:tables:link.filter_expression="PGM = 'PROGRAM'"
                layout_ptr:tables:link.order_expression="CASE"
                layout_ptr:tables:link.query()

                'display the browse
                layout_ptr.show()
                layout_ptr.activate()


                Hope this helps.

                Tom

                Comment


                  #9
                  RE: Menu creation - I'm a novice

                  Wanda,

                  This is way more than you asked for, but it might help you to study this script. It opens a dialog box to get a start and end date, asks for a slelction of reports, runs a query to select the records, then prints the report:

                  dim FormPntr as p
                  dim ScrnHigh as n
                  dim ScrnWide as n
                  dim FormHigh as n
                  dim FormWide as n
                  dim global StartDate as d
                  dim global EndDate as d
                  dim LastButton as c
                  dim global mn as c
                  '**** Get the dates ****
                  ScrnHigh = ui_info(1)
                  ScrnWide = ui_info(0)
                  FormPntr=:form.load("DateRange","Dialog")
                  '**** Center the dialog box ****
                  FormHigh = FormPntr.Height
                  FormWide = FormPntr.Width
                  FormPntr.top = (ScrnHigh - FormHigh)/2
                  FormPntr.left = (ScrnWide - FormWide)/2
                  FormPntr:Sdate.Activate()
                  FormPntr.show()
                  '**** Script pauses til user closes dialog box****
                  '**** Sdate and Edate are fields on the dialog box ****
                  StartDate=FormPntr:SDate.value
                  EndDate=FormPntr:EDate.value
                  LastButton=FormPntr.last_pressed()
                  FormPntr.close()
                  if LastButton="CANCELBUTTON"
                  goto Cancelled
                  end if
                  '**** Get the report type ****
                  dim ReportName as c
                  dim PrintType as c
                  dim qfilter as c
                  dim qorder as c
                  ReportName=ui_get_list("REPORT NAME",1,"PERFORMANCE","SUMMARY","INCENTIVE")
                  ReportName=alltrim(ReportName)
                  select
                  case ReportName=""
                  goto Cancelled
                  case ReportName="PERFORMANCE"
                  mn=ui_get_list("MACHINE NUMBER",1,"All","1","2","3","4","5","6")
                  mn=alltrim(mn)
                  if mn="All".or.mn=""
                  qfilter="between(MeltDate,StartDate,EndDate)"
                  else
                  qfilter="(between(MeltDate,StartDate,EndDate)).and.(left(MachSide,1)=mn)"
                  end if
                  ReportName="Perf_Report"
                  qorder="ProdCode+SerialNo"
                  case ReportName="SUMMARY"
                  Reportname="PerfSummary"
                  qfilter="between(MeltDate,StartDate,EndDate)"
                  qorder="ProdCode+SerialNo"
                  case ReportName="INCENTIVE"
                  ReportName="Incentive"
                  qfilter="between(MeltDate,StartDate,EndDate)"
                  qorder="left(machside,1)+serialno"
                  end select
                  '**** Print or view the report ****
                  PrintType=ui_get_list("SEND TO",1,"PRINTER","SCREEN")
                  if PrintType=""
                  goto Cancelled
                  elseif PrintType="PRINTER" then
                  :report.print(ReportName,qfilter,qorder)
                  else
                  :report.preview(ReportName,qfilter,qorder)
                  end if
                  ui_beep(48)
                  ui_msg_box("PRINT COMPLETE","The report has finished printing")
                  END

                  cancelled:
                  ui_msg_box("CANCELLED","Report Printing was cancelled")
                  end

                  good luck!
                  Pat Bremkamp
                  MindKicks Consulting

                  Comment


                    #10
                    RE: Menu creation - I'm a novice

                    Thanks Tom and Pat. I will play with these this afternoon or tomorrow a.m., and get back to you. I appreciate it!
                    Wanda

                    Comment

                    Working...
                    X