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

For Next Loop

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

    For Next Loop

    I have a button on a form with this code
    it is not recognizing the if statements
    What is the correct syntax inside the for next loop.
    example
    If tstat.OCCUPIED = .T. then
    It will not recognize tstat.occupied
    any ideas
    Thanks
    Charlie Crimmel


    Code:
    DIM Global vtable_no As C
    DIM Global vTablenum as C
    DIM Global vtableok as L
    Dim Global vbuttonno as C
    Dim Global vnexttable As C
    Dim Global vicount AS N
    Dim Global vcolor AS C
    'var->vtable_no = "1"
    'var->vtablenum = "1"
    var->vbuttonno = ""
    var->vtableok = .F.
    var->vnexttable = ""
    var->vicount = 0
    var->vtable_no = ""
    var->vcolor = ""
    tstat = table.current()
    
    FOR i = 1 TO 20 
    var->vicount = var->vicount + 1
    var->vtable_no = alltrim(str(var->vicount,5))
    
    If tstat.OCCUPIED = .T. then
    	var->vcolor = "Red"
    end if
    If tstat.notoccupied = .T. then
    	var->vcolor = "Green"
    end if	
    If tstat.reserved = .T. then
    	var->vcolor = "Yellow"
    end if	
    If tstat.closed = .T. then
    	var->vcolor = "Pink"
    end if
    vbuttonno = "button" + alltrim(var->vtable_no) + ".fill.color=" + chr(34)+ var->vcolor + chr(34)
    	
    trace.WriteLn("var->vicount = " + var->vicount)
    trace.WriteLn("var->vtable_no = " + var->vtable_no)
    trace.WriteLn("Variable Button Fill Color = " + vbuttonno)
    tstat.fetch_next()
    next
    end

    #2
    Re: For Next Loop

    Form based on table or set? If set, what is parent table?
    There can be only one.

    Comment


      #3
      Re: For Next Loop

      Single table
      no set

      tstat = table.current()
      It stands for table status

      Comment


        #4
        Re: For Next Loop

        Charlie,

        Is it not recognizing it, or simply overwriting the vcolor?

        I would put a debug(1) at the beginning of the loop and see what is going on. You can see the value of vcolor as you pas through each IF statement. Your traces only show the end result on each pass.

        Tom

        Comment


          #5
          Re: For Next Loop

          Works fine here.

          var->vicount = 1
          var->vtable_no = 1
          Variable Button Fill Color = button1.fill.color="Red"
          var->vicount = 1
          var->vtable_no = 1
          Variable Button Fill Color = button1.fill.color="Red"
          var->vicount = 1
          var->vtable_no = 1
          Variable Button Fill Color = button1.fill.color="Red"
          var->vicount = 2
          var->vtable_no = 2
          Variable Button Fill Color = button2.fill.color="Red"
          var->vicount = 3
          var->vtable_no = 3
          Variable Button Fill Color = button3.fill.color="Red"
          var->vicount = 4
          var->vtable_no = 4
          Variable Button Fill Color = button4.fill.color="Red"
          var->vicount = 5
          var->vtable_no = 5
          Variable Button Fill Color = button5.fill.color="Red"
          var->vicount = 6
          var->vtable_no = 6
          Variable Button Fill Color = button6.fill.color="Red"
          var->vicount = 7
          var->vtable_no = 7
          Variable Button Fill Color = button7.fill.color="Red"
          var->vicount = 8
          var->vtable_no = 8
          Variable Button Fill Color = button8.fill.color="Red"
          var->vicount = 9
          var->vtable_no = 9
          Variable Button Fill Color = button9.fill.color="Red"
          var->vicount = 10
          var->vtable_no = 10
          Variable Button Fill Color = button10.fill.color="Red"
          var->vicount = 11
          var->vtable_no = 11
          Variable Button Fill Color = button11.fill.color="Red"
          var->vicount = 12
          var->vtable_no = 12
          Variable Button Fill Color = button12.fill.color="Red"
          var->vicount = 13
          var->vtable_no = 13
          Variable Button Fill Color = button13.fill.color="Red"
          var->vicount = 14
          var->vtable_no = 14
          Variable Button Fill Color = button14.fill.color="Red"
          var->vicount = 15
          var->vtable_no = 15
          Variable Button Fill Color = button15.fill.color="Red"
          var->vicount = 16
          var->vtable_no = 16
          Variable Button Fill Color = button16.fill.color="Red"
          var->vicount = 17
          var->vtable_no = 17
          Variable Button Fill Color = button17.fill.color="Red"
          var->vicount = 18
          var->vtable_no = 18
          Variable Button Fill Color = button18.fill.color="Red"
          var->vicount = 19
          var->vtable_no = 19
          Variable Button Fill Color = button19.fill.color="Red"
          var->vicount = 20
          var->vtable_no = 20
          There can be only one.

          Comment


            #6
            Re: For Next Loop

            Are you trying to change the button colors?

            evaluate_template(vbuttonno)
            There can be only one.

            Comment


              #7
              Re: For Next Loop

              error
              Last edited by Mike Wilson; 12-23-2010, 01:55 PM.
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: For Next Loop

                Charlie,

                Code:
                If tstat.OCCUPIED = .T. then
                	var->vcolor = "Red"
                end if
                If tstat.notoccupied = .T. then
                	var->vcolor = "Green"
                end if	
                If tstat.reserved = .T. then
                	var->vcolor = "Yellow"
                end if	
                If tstat.closed = .T. then
                	var->vcolor = "Pink"
                end if
                There's another issue you may want to consider. If tstat.OCCUPIED and tstat.notoccupied are opposites, get rid of one (eliminate tstat.notoccupied). You can then use:

                Code:
                if tstat.occupied then
                    ....
                
                OR
                
                if .not. tstat.occupied then
                    ....
                Otherwise you could have the illogical situation where both variables = .t. or both = .f.


                Eric
                There are three kinds of people in the world: those who can count, and those who can't.

                Comment


                  #9
                  Re: For Next Loop

                  try this - note the code in the browse onsave and canrowchange events
                  there is a lot that needs to be done - like unchecking other columns when you check one. Also, in the table field rules, in field events, notice what I did with occupied

                  t=table.current()
                  if is_object("Table_Status_NewTest")
                  :Table_Status_NewTest:browse1.commit()
                  end if
                  Cole Custom Programming - Terrell, Texas
                  972 524 8714
                  [email protected]

                  ____________________
                  "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                  Comment


                    #10
                    Re: For Next Loop

                    ok - here it is cleaned up, with the change occurring when you click any of the logicals, and "unchecking" the rest

                    note no calculated fields or variables are used - the only looping occurs at the oninit event - to set all the colors


                    ***********************
                    although as I think about it, I bet this is a touch screen app. If that is so, and the buttons are that large, I would put little colored buttons at each corner of each big table button, and let them click the corner to set the value
                    Last edited by martinwcole; 12-24-2010, 05:09 PM.
                    Cole Custom Programming - Terrell, Texas
                    972 524 8714
                    [email protected]

                    ____________________
                    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                    Comment


                      #11
                      Re: For Next Loop

                      Thanks for everyones help.
                      I changed my way of thinking.
                      Instead of using the table to control the buttons, I am using the buttons to control the table.
                      You can just touch (yes Martin it is a touch screen app) or click
                      the buttons. Each click will toggle the button to another status and change the tabls.

                      Comment

                      Working...
                      X