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

Date Script

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

    #16
    Re: Date Script

    I mean It(vNext variable) did not save into the a field of the Work_order table.
    Did you still get an error?
    Is there a field in the wrkodr_hd table with the name mon?

    You can watch the script execution by placing the command

    debug(1)

    as the first line. Then run the script. The debugger will open and you can use the F12 key to cause the script to step one line at a time. You will be able to see which lines get executed and which are skipped (due to not meeting an if test, for instance.). You can type variable names in the "example" boxes and see how their values change.

    I look forward to your sample.
    There can be only one.

    Comment


      #17
      Re: Date Script

      John,

      How about an update? Did you get this working? Are you able to create a single table/set zip now?
      There can be only one.

      Comment


        #18
        Re: Date Script

        Stan,
        Not Yet

        I tried to create the Zip file. I opened this zip but I cannot open it because no adb file. If I added the adb file then entire tables are shown.

        Comment


          #19
          Re: Date Script

          Getting somewhere now.

          It is simple enough to add your set to an existing database.

          Try this.

          Code:
          dim thdr as p
          dim i as n
          dim vDur as n 
          dim vSDate as d
          dim vNext as c
          thdr=table.open("wrkodr_hd",File_rw_shared)
          
          thdr.index_primary_put()
          thdr.fetch_first()
          while .not. thdr.fetch_eof()
          vSDate=thdr.Plan_startdate 'move these two lines to here
          vDur=thdr.Plan_duration 'move these two lines to here
          if vdur>0 then
          	for i=1 to vdur
          		vnext=vsdate+i
          		'vDate=ui_msg_box("counting",vsdate+i)
          		'vDays=ui_msg_box("Day",cdow(ctod(vNext)))
          
          		Select
          		    case cdow(ctod(vNext))="Monday"
          		        thdr.change_begin()
          				     thdr.mon= [COLOR="red"]ctod(vNext)[/COLOR]
          				thdr.change_end(.t.)
          			case cdow(ctod(vNext))="tuesday"
          			    thdr.change_begin()
          				     thdr.Tue=[COLOR="Red"]ctod(vNext)[/COLOR]
          				thdr.change_end(.t.)
          			case cdow(ctod(vNext))="Wednesay"
          			    thdr.change_begin()
          				     thdr.wed= [COLOR="Red"]ctod(vNext)[/COLOR]
          				thdr.change_end(.t.)	
          		end select
          
          		next i
          	else
              ui_msg_box("No Duration","Enter Duration Information")	
          end if
          thdr.fetch_next()	
          end while
          
          thdr.close()
          end
          Since the fields Mon, Tue, etc are date fields you can't put text like "12/14/2009" in them. Also Tuesday was misspelled in

          case cdow(ctod(vNext))="tuesay"

          Wednesday is misspelled as well.

          case cdow(ctod(vNext))="Wednesay"
          Last edited by Stan Mathews; 12-15-2009, 06:08 PM.
          There can be only one.

          Comment


            #20
            Re: Date Script

            Stan,

            I Just created new zip and attached here.

            I want to store the Date into "Mon" field if the vNext date is Monday.
            I will express on Color equation ... isnotblank("mon") then Lime Color other Black color.

            But, My alternate method concept had a problem because if the start_date is Friday and more than two days (only business days) then the color bar will be out of range....

            Comment


              #21
              Re: Date Script

              You'll have to spell it out for me. What do you want to happen if the duration would cause the script to fill in the "day" fields through the weekend? Do you want to cycle back to the first of the week?

              Thursday start, duration 3, populate Friday, Monday, Tuesday?
              There can be only one.

              Comment


                #22
                Re: Date Script

                Stan,

                actually, the deburg(1) runs well witout any problem. I get the value of vNext, vDate and vdays. But the WorkOrder table did not have the date data on here yet.
                My "Mon" field is a Data type. vNext is number and vDate is convert to data field.

                Comment


                  #23
                  Re: Date Script

                  Stan,

                  Code:
                  Thursday start, duration 3, populate Friday, Monday, Tuesday?
                  Yes, but It should be exposed by following week, isn't it?

                  Let's worry about it after solve the vNext or vDate problem.

                  Comment


                    #24
                    Re: Date Script

                    As far as I can tell the script in post 19 is working once the misspelling of Wednesday is corrected.
                    There can be only one.

                    Comment


                      #25
                      Re: Date Script

                      Stan,

                      Yes, Thank you. I get the result after I changed and used ctod(vNext).

                      Code:
                       vnext= vsdate-1+i
                       'vDate= ctod(vNext) 'Conver to Date Filed Type
                       'vDays=cdow(ctod(vNext))'Convert to Day of Week
                      			    			     
                       Select
                       Case cdow(ctod(vNext))="Monday"
                      	    thdr.change_begin()
                      	    thdr.Mon =ctod(vNext) 
                      	    'thdr.Mon = vDate
                      	    thdr.change_end(.t.)
                       Case cdow(ctod(vNext))="tuesday"
                      	   'and repeated...
                      Do you know why
                      Code:
                       "Case vDate="Monday"  .... thdr.Mon = vDate
                      the above code did not work? I called vDate as convert to data type.

                      Comment


                        #26
                        Re: Date Script

                        Since we are working with your set zip only the script you have on the code tab is not available to me. (That's stored in the database files, not the table/set files)

                        You could copy and paste it here if you like.
                        There can be only one.

                        Comment


                          #27
                          Re: Date Script

                          Stan,

                          Here the Code
                          Code:
                          'Date Created: 12-Dec-2009 08:22:31 PM
                          'Last Updated: 15-Dec-2009 05:56:39 PM
                          'Created By  : John Koh
                          'Updated By  : John Koh
                          
                          'debug(1)
                          
                          dim thdr as p
                          dim i as n
                          dim vDur as n 
                          dim vSDate as d
                          dim vNext as c
                          dim vDate as d
                          
                          thdr=table.open("wrkodr_hd",File_rw_shared)
                          'Query.filter=".t."
                          'Quary.order=""
                          'query.options=""
                          thdr.index_primary_put()
                          thdr.fetch_first()
                          while .not. thdr.fetch_eof()
                          	vSDate=thdr.Plan_startdate
                          	vDur=thdr.Plan_duration
                          
                          if vdur>0 then
                          		for i=1 to vdur
                          			vnext= vsdate-1+i
                          			     'vDate=ui_msg_box("counting",vNext)
                          			'vDate= ctod(vNext) 'Conver to Date Filed Type
                          			     'vdate=ui_msg_box("date", vdate)     
                          			'vDays=cdow(ctod(vNext))'Convert to Day of Week
                          			     'vDays=ui_msg_box("Day",vdays)
                          			     
                          			Select
                          			   Case cdow(ctod(vNext))="Monday"
                          				    thdr.change_begin()
                          					     thdr.Mon =ctod(vNext) 'tHdr.Mon is a date Feild and vdate is a Data Field. Why not?
                          					     'thdr.Mon = vdate
                          				    thdr.change_end(.t.)
                          			   Case cdow(ctod(vNext))="tuesday"
                          				    thdr.change_begin()
                          					     thdr.Tue=ctod(vNext)
                          				    thdr.change_end(.t.)	    
                          		       Case cdow(ctod(vNext))="Wednesday"
                          				    thdr.change_begin()
                          					     thdr.Wed=ctod(vNext)
                          				    thdr.change_end(.t.)
                          			   Case cdow(ctod(vNext))="Thursday"
                          				    thdr.change_begin()
                          					     thdr.thu=ctod(vNext)
                          				    thdr.change_end(.t.)
                          			   Case cdow(ctod(vNext))="Friday"
                          				    thdr.change_begin()
                          					     thdr.Fri=ctod(vNext)
                          				    thdr.change_end(.t.)
                          			   Case cdow(ctod(vNext))="Saturday"
                          				    thdr.change_begin()
                          					     thdr.Sat=ctod(vNext)
                          				    thdr.change_end(.t.)
                          			   Case cdow(ctod(vNext))="Sunday"
                          				    thdr.change_begin()
                          					     thdr.Sun=ctod(vNext)
                          				    thdr.change_end(.t.)	    	    	    	    
                          		   end select		    
                                  next i
                          		else		
                          	    ui_msg_box("No Duration","Enter Duration Information")	
                          end if			     			
                          thdr.fetch_next()	
                          end while
                          thdr.close()
                          end
                          If I changed the duration or date, what is an additional scripts for re-write to field?
                          In order to control the overflew End_date, My next plans are
                          (1) create a new table . If I control the End_date with Week() function ... I may be able to add the continuation(overflow) date records in the new table but I am not sure.
                          (2) Apply with Dr Wayne's Calendar which shows by Monthly.
                          (3) or depend on you idea if you don't mind.
                          (4) Is it possible to make the outline frame and fill in(display) the data. I tied the Crosstab Operation but not good result. Weekly date range, add color and display Project Name problem

                          I attached my manual working plan which I want to have a form (data base on work order) and print.

                          Comment


                            #28
                            Re: Date Script

                            John,

                            Of these

                            Code:
                            'vDate=ui_msg_box("counting",vNext)
                            'vDate= ctod(vNext) 'Conver to Date Filed Type
                            'vdate=ui_msg_box("date", vdate)     
                            'vDays=cdow(ctod(vNext))'Convert to Day of Week
                            'vDays=ui_msg_box("Day",vdays)
                            Only

                            vDate= ctod(vNext) 'Conver to Date Filed Type and
                            vDays=cdow(ctod(vNext))'Convert to Day of Week


                            actually does anything.


                            Please see the documentation for ui_msg_box(). Ui_msg_box() does not do any conversions.

                            vdate=ui_msg_box("date", vdate)

                            says assign the response code of a message box with the title "date" and the message vdate (character representation of a date to the vdate variable. The response code is a numeric data type.

                            It is unclear how many of these were active in your script.

                            I'll look at the rest of your questions tomorrow.
                            There can be only one.

                            Comment


                              #29
                              Re: Date Script

                              Good Morning, Stand

                              vDate= ctod(vNext) 'Conver to Date Filed Type and
                              vDays=cdow(ctod(vNext))'Convert to Day of Week

                              actually does anything.
                              Did you mean it did not convert to "date" nor "days" ?
                              or
                              it (Case vDays="Monday") is bad script.

                              vdate=ui_msg_box("date", vdate)

                              It is unclear how many of these were active in your script.
                              I used it for temporary, just see the result.

                              Comment


                                #30
                                Re: Date Script

                                Code:
                                dim vdate as d
                                dim vnext as c
                                vnext = "12/15/2009"
                                
                                vDate=ui_msg_box("counting",vNext) ' can't assign a number to a date type variable
                                ERROR: Variable type mismatch
                                
                                vDate= ctod(vNext) 'Conver to Date Filed Type [COLOR="Red"]'this does work[/COLOR]
                                ? vdate
                                = {12/15/2009}
                                If you have the line
                                ui_msg_box("counting",vNext)
                                in a script, a message box will appear.

                                If you have the line
                                vDate=ui_msg_box("counting",vNext)
                                a message box will appear and Alpha will try to assign the return code (numeric value indicating what button was pressed) to the variable to the left of the equals sign.
                                There can be only one.

                                Comment

                                Working...
                                X