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

set field to hold current date everyday

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

    set field to hold current date everyday

    I am stuck in a wierd situation. I am working with a data filled lookup table which has a field called "valid_until" which houses date entries. For some records in this table there are dates in this field, however for the others it is blank. It is the blank fields that I am trying to manipulate.

    This is what I have come up with so far. I went into the field rules->data entry of the table and then set the default value for the "valid_until" field to have a conditional default value where the condition would be: ISBLANK("Valid_until") and the default value would be: date()

    However, just when things seem to be going the right direction another problem arises. First of all, all this seemed useless as the table already has all the data in it and this default data entry only applies when the user is entering data into the table. Another problem is that even if i had managed to set the date of the blank "valid_until" fields to "date()" which is the current date than that current date would not be the current date the day after.

    Im trying to figure out if there would be a way to somehow have these blank "valid_until" fields set to be always the current date regardless of what day it is. IS that somehow possible? If so how would i even apply it to a table which already has data?

    If anyone has any clues, I would appreciate any help. Thank you all.

    #2
    RE: set field to hold current date everyday

    Do you actually need to set the values in the table, or do you just need to display the current date on the form?

    As I see it, if you change the values in the table, how would the field rule know which records to change tomorrow, because they are no longer blank.

    Try using a calculated field:
    show_date=if(ISBLANK("Valid_until"),date(),Valid_until)

    You could then use that field's OnArrive event, or an invisible button on top of the field to pop up a dialog box (IF in change mode) to prompt for a new date, assuming you need to manually change the value.

    Bob

    Comment


      #3
      RE: set field to hold current date everyday

      Raheel,

      I agree with Robert. There's no reason to substitute a temporary field value in each empty 'valid_until' field. Just arrange your script or report to substitute the desired field value in your layout or report. Besides, once you stick a value in each of these fields, how will you find them again when you get back to work the next day. Since they'll no longer be empty how will you automate the process of substituting in the table new field values for the exact same records?

      -- tom

      Comment


        #4
        RE: set field to hold current date everyday

        Thank you guys for your thoughts. I am sorry for this late reply. Let me provide more details and maybe you can see whats going on better.

        There is a lookup table called: "authority" which houses the field in question: "valid_until". This table has 100 records (peoples names) that were imported from excel. For some records there is date for the "valid_until" field. The purpose of this date is to give a that record authority status up until that "valid_until" date. Therefore, on a form this lookup table is filtered by an expression that eliminates all those records whose "valid_until" date has past or expired.

        It works beatifully, however for some records in the authority table there are not dates. This was because these records (people) were valid_until "Further Notice". It is this that I am trying to tackle this in Alpha. So i thought the best way to do this would be to have those records, with valid_until date set to "Further Notice" be set to the current date every day, so virtually there is no certain "valid_until" date because everyday this person's would be an authority figure.

        I thought about simply setting these records (peoples) with "Further Notice" valid_until status to a specific date, say one year from today. However, some people might be valid for more than a year and some less and therefore it later on unwanted people will get filtered out by the expression.

        I hope you better understand my scenario now. If there is another alternative that seems better please let me know, I would love to hear it.

        Comment


          #5
          RE: set field to hold current date everyday

          I'm not sure how the records with empty valid_until fields are ever going to have proper valid_until dates set, but how about this.

          Run a operation upon application startup each day that marks the records in question, then an operation that puts in the current date.

          At the end of the day, reverse the process, check for marked records, blank the valid_until field and unmark the records.

          This would assume that you never legitimately set the valid_until date to the current date for any purpose other than to aid in your filtering.
          There can be only one.

          Comment


            #6
            RE: set field to hold current date everyday

            Raheel, why don't you want it to just display "Further Notice"?

            show_date=if(ISBLANK("Valid_until"),"Further Notice",date_format(date(),"Month d, yyyy"))

            Just a thought,
            Bob

            Comment


              #7
              RE: set field to hold current date everyday

              Stan, I like your idea, however that sounds like too many operations running in the background creating unnecessary overhead. I am gona go for what Rob has just advised. I think by simply putting in "Further Notice" in the "valid_until" field things would work out fine.

              But now, I would like to get some aid in how I would construct the filter expression for the lookup field (this field is in another table all together) such that all records in the "authority" table are displayed except for those whose "valid_until" date is either expired or is "further notice"?? Before I was simply using this filter expression: valid_until>=date()

              This filter expression would eliminate all those authority personnel whose valid_until date had expired. Now I would like to continue using this in conjunction with all those personnel whose valid until status is set to "Futher Notice".

              Furthermore, I dont understand where I would use the script shared by Rob: show_date=if(ISBLANK("Valid_until"),"Further Notice",date_format(date(),"Month d, yyyy"))

              This script will put in the "Futher Notice" in the blank "valid_until" fields but what is the next expression doing: date_format....??

              I also cant enter characters in valid_until field as it is currently set house DATE fied type. Looks like every avenue i take is resulting in dead ends...

              Comment


                #8
                RE: set field to hold current date everyday

                "...I dont understand where I would use the script shared by Rob:
                show_date=if(ISBLANK("Valid_until"),"Further Notice",date_format(date(),"Month d, yyyy")) "

                the last part *should* have been:
                ... ,date_format(Valid_until,"Month d, yyyy"))

                In Form design mode, you would declare a variable named show_date defined by the given expression. If the field Valid_until is blank, the variable show_date will be set to "Further Notice", otherwise it will contain the Valid_until date with the formatting shown.

                "Before I was simply using this filter expression: valid_until"=date()
                This filter expression would eliminate all those authority personnel whose valid_until date had expired. Now I would like to continue using this in conjunction with all those personnel whose valid until status is set to "Futher Notice". "

                We are not changing the value in the field, simply displaying something else if the field is empty. Your filter should still work.

                In order to change the value of the Valid_until field, you could put an invisible button on top of the calculated field which opens a dialog box asking for the revised date, then saves it to the table and finally refreshes the screen.

                Bob

                Comment


                  #9
                  RE: set field to hold current date everyday

                  Why not just set the valid_until date 10 years (or more) in the future? Just make sure that you enter the year as 4 digits (especially if it is past 2020) and display all 4 digits of the year on your form so there is no confusion. For example just use the date 12/31/2050 as your valid_until date. This would be very simple to put into all your blank fields with a replace operation, and you would not need to change your filter.

                  Howard
                  Howard G. Cornett, Independent Consultant

                  Comment


                    #10
                    RE: set field to hold current date everyday

                    Guys thanks a lot for your wonderful ideas. I liked rethinking over the various possibilities shared to me by all of you. This is how I have tackled my problem. I simply set the filter for the lookup field to be:

                    (Valid_until "= date() ) .or. isblank("Valid_until")

                    All those records who have "valid_until" dates as "further notice" is set to blank and using this way they are caught by the filter and added into the lookup field.

                    Once again thank you for your time and cooperation.

                    Comment

                    Working...
                    X