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

Object name with onpush indicator

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

    Object name with onpush indicator

    I have a form with multiple fields (50) one for each year and corresponding buttons that are labeled with years. The fields will have 3 options: "S", "C", or blank. I would like to create a script that retrieves the object name of the button pushed. I should be able to write the xbasic that would determine which operation to complete.

    I would like to identify (Object Name) Btn_S2000 as triggered with onpush. Find the routine that matches Btn_S2000. Within that routine determine which specs are met and then put the data in Senate->2000.


    table name -- legis_senate
    alias -- Senate

    Button -- Btn_S2000
    Field -- Senate->S2000

    #2
    Re: Object name with onpush indicator

    Gary

    This looks like a question.

    This forum is for code contribution.

    Let me know what version you are using and I'll move this post.
    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


      #3
      Re: Object name with onpush indicator

      Sorry.

      I'm using Alpha Anywhere.

      Comment


        #4
        Re: Object name with onpush indicator

        put the code that determines the operation to complete into a udf

        Have each button call the same function with
        Code:
        yourudf(parentform.Active())
        The paramenter received by the function will be a string with the button name.

        Comment


          #5
          Re: Object name with onpush indicator

          You can get the button object name with

          this.name

          If the field corresponding to Btn_S2000 has the object name S2000 you know that the object name of the field is

          right(this.name(),5)

          and the value in the field is eval(right(this.name(),5)+".value")

          if the field contains text you would use

          eval(right(this.name(),5)+".text")
          There can be only one.

          Comment


            #6
            Re: Object name with onpush indicator

            Is there any Xbasic documentation that is helpful? I've searched Alpha 5 but it appears to be very minimal. It may be that I need to obtain Xbasic background from another source.

            Comment


              #7
              Re: Object name with onpush indicator

              I don't think you're going to find a sample code snippet in any documentation that will do what you want. It's more a question of putting the pieces together.

              For any button the object name is this.name()

              Since you have fields named similarly to the buttons you have to parse the button name to get the associated field name.
              You use that field name and its properties to obtain the field value.
              You obtain "routine that matches" by combining the field name and the field value, I'm guessing.
              There can be only one.

              Comment


                #8
                Re: Object name with onpush indicator

                I'm not sure but maybe this could help you.
                Attached Files
                Alpha 5 Version 11
                AA Build 2999, Build 4269, Current Build
                DBF's and MySql
                Desktop, Web on the Desktop and WEB

                Ron Anusiewicz

                Comment


                  #9
                  Re: Object name with onpush indicator

                  Right now that won't help with determining the right routines to provide the right data. But part of it should help when I turn it into a function. The this.name() and parentform.Active() appear to prove useful. I am stuck with it not providing the right data each time.


                  SenateTerms.PNG


                  Buttons have a year for each election. Push to automatically put right status in box to right of year. Since this is for Senate elections they mostly run for election once every six years. The years they run it should have "S". The 2 election years after should have a "C". It should blank it out if there is a "S" or "C".

                  If election year box is blank and previous election is blank -- put S in.
                  If election year box is blank and previous election has "C" and election before that has "C" -- put S in.
                  If election year box is blank and previous election has "C" and election before that has "S" -- put C in.
                  If election year box has "C" or "S" -- blank it out.

                  The following is where I am with this.

                  Dim Senate_Status as C
                  Dim Senate_E1 as C
                  Dim Senate_E2 as C
                  Dim Senate_E3 as C
                  Dim Tbl_Senate as C

                  Tbl_Senate ="Senate->S"

                  select
                  'Senate 1964
                  case parentform.Active() ="Btn_S1964"
                  Senate_Year = val(right(this.Name(),4))
                  DELETE Senate_Status
                  Senate_E1 =Tbl_Senate +str(Senate_Year,4)
                  Senate_E2 =Tbl_Senate +str(Senate_Year-2,4)
                  Senate_E3 =Tbl_Senate +str(Senate_Year-4,4)
                  select
                  case isblank(Senate_E1)
                  select
                  case isblank(Senate_E2)
                  Senate_Status = "S"
                  case isnotblank(Senate_E2)
                  select
                  case Senate_E2 + "='S'"
                  Senate_Status = "C"
                  case Senate_E2 + "='C' .and. " +Senate_E3 + "='C'"
                  Senate_Status = "S"
                  case else
                  Senate_Status =""
                  end select
                  case else
                  Senate_Status =""
                  end select
                  case isnotblank(Senate_E1)
                  Senate_Status =""
                  case else
                  Senate_Status =""
                  end select
                  parentform:Senate_1964.value=Senate_Status

                  Comment


                    #10
                    Re: Object name with onpush indicator

                    Is this

                    Senate_E1 = Tbl_Senate +str(Senate_Year,4)

                    supposed to be getting a field value into the Senate_E1 variable?
                    There can be only one.

                    Comment


                      #11
                      Re: Object name with onpush indicator

                      Originally posted by Stan Mathews View Post
                      Is this

                      Senate_E1 = Tbl_Senate +str(Senate_Year,4)

                      supposed to be getting a field value into the Senate_E1 variable?
                      Looks like Gary is building the fieldname.

                      Time to use debug (1) and or the trace window.
                      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


                        #12
                        Re: Object name with onpush indicator

                        Yes, Senate_E1 is the field that corresponds to the button push that will hold either "S", "C", or will be blank.
                        Senate_E2 will be the field to the last election and Senate_E3 is for 2 elections previous.

                        I"m getting a snag with it reporting Variable "Senate_Status" not found when there is an "S" in the last election (Senate_E2).

                        Comment


                          #13
                          Re: Object name with onpush indicator

                          This would all be easier to diagnose with a sample database. I've never used the construction you're using.

                          I think your isnotblank() test needs modification

                          Code:
                          Dim Senate_Status as C
                          Dim Senate_E1 as C
                          Dim Senate_E2 as C
                          Dim Senate_E3 as C
                          Dim Tbl_Senate as C
                          
                          Tbl_Senate ="Senate->S"
                          
                          select
                          	'Senate 1964
                          	case parentform.Active() ="Btn_S1964"
                          		Senate_Year = val(right(this.Name(),4))
                          		DELETE Senate_Status
                          		Senate_E1 =Tbl_Senate +str(Senate_Year,4)
                          		Senate_E2 =Tbl_Senate +str(Senate_Year-2,4)
                          		Senate_E3 =Tbl_Senate +str(Senate_Year-4,4)
                          		select
                          		case isblank(Senate_E1)
                          			select
                          			case isblank(Senate_E2)
                          				Senate_Status = "S"
                          			case isnotblank(Senate_E2)
                          				select
                          				case Senate_E2 = "S"
                          					Senate_Status = "C"
                          				case Senate_E2 ="C" .and. Senate_E3 ="C"
                          					Senate_Status = "S"
                          				case else
                          					Senate_Status =""
                          			end select
                          			case else
                          				Senate_Status =""
                          		end select
                          		case isnotblank(Senate_E1)
                          			Senate_Status =""
                          		case else
                          			Senate_Status =""
                          	end select
                          	parentform:Senate_1964.value=Senate_Status
                          or

                          Code:
                          case isnotblank(Senate_E2)
                          				select
                          				case eval(Senate_E2) = "S"
                          					Senate_Status = "C"
                          				case eval(Senate_E2) ="C" .and. eval(Senate_E3) ="C"
                          					Senate_Status = "S"
                          				case else
                          					Senate_Status =""
                          			end select
                          Last edited by Stan Mathews; 12-22-2014, 01:14 PM.
                          There can be only one.

                          Comment


                            #14
                            Re: Object name with onpush indicator

                            Here is the file. I was still testing different options. Trying to figure out how to determine the name for the field name, etc.

                            Congress.zip

                            The form that is in need is Terms_Senate.
                            Last edited by gschepp; 12-22-2014, 08:26 PM.

                            Comment


                              #15
                              Re: Object name with onpush indicator

                              Here is the file. I was still testing different options. Trying to figure out how to determine the name for the field name, etc.

                              Congress.zip

                              Comment

                              Working...
                              X