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

Year from Date Question

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

    Year from Date Question

    What am I doing wrong here..

    Created a Variable field called VarYear.
    set as a combo box in the fields properties.
    On the choices tab, its computed automatically, from values of a table/set
    table is current.
    In the field/expression box, I selected <expression> and typed/selected Year(Purchase_Date). in the expression builder.
    and then checkmarked "only unique fields".

    When clicking on the Preview button below the checkbox, I dont get any "years".
    But when the expression builder was up and I entered Year(Purchase_Date)
    in the results area it showed the years correctly scrolling thru the records.


    Of course when switching to the form with the VarYear field, I get nothing in the dropdown.


    Thanks

    #2
    Re: Year from Date Question

    Is there a data type mismatch? The YEAR() function returns NUMERIC data. Is your variable CHARACTER?

    Comment


      #3
      Re: Year from Date Question

      I checked the table structure and I have PurchaseDate as a Date type and couldnt figure out how to check the type for the variable field so I just recreated it and used the numeric type and it still has the same outcome.

      Comment


        #4
        Re: Year from Date Question

        Try placing Year(Purchase_Date) in the 'Display Order' box as well.
        Tim Kiebert
        Eagle Creek Citrus
        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

        Comment


          #5
          Re: Year from Date Question

          Scott,
          If you recreated the variable using the same name you either have to close Alpha and restart to eliminate the original variable type or, easier, use the interactive editor and type delete VarYear and run it to delete the variable. Now when created it will be what you changed it to....IOW once a variable is created as one type it will stay that unless deleted and then recreated as another type.
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: Year from Date Question

            Originally posted by Tim Kiebert View Post
            Try placing Year(Purchase_Date) in the 'Display Order' box as well.
            Tried your suggestion and clicking the preview button still results in no "years" shown in the list


            Originally posted by MikeC View Post
            Scott,
            If you recreated the variable using the same name you either have to close Alpha and restart to eliminate the original variable type or, easier, use the interactive editor and type delete VarYear and run it to delete the variable. Now when created it will be what you changed it to....IOW once a variable is created as one type it will stay that unless deleted and then recreated as another type.
            Ok, I deleted and closed out alpha, restarted and recreated the variable again. But I have the same results.

            This is what I did, what I have..

            On my form, I dragged the field Purchasedate onto it.
            Right clicked on the field, and from its field properties selected the tab "setup".
            Under field description,
            Changed the name to PurchaseYear.
            Clicked on the box to the right of "field" and selected "add variable".
            Selected-Layout/Numeric/and typed the name VarYear.
            Back on the control type I selected Combo Box and on the choices tab.
            Computed automatically.
            Values from a Table/set
            Current Table
            at the field expression values to display I picked Expression and typed
            Year(PurchaseDate)
            Did the same thing for the Display order
            Checked "Display only unique keys"
            Clicked the preview button and theres nothing there.

            Thanks

            Comment


              #7
              Re: Year from Date Question

              Scott,
              A bit stymied on this one--and out of time this am to see if perhaps I am also looking at this incorrectly. It works for character fields but NOT for numeric or date fields.....doesn't seem right.

              Maybe before I get back Tim or Tom will have an answer for you (and me at this point!!).
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #8
                Re: Year from Date Question

                Dim the variable as c and in your choices, using an expression, use cyear() instead of year().

                Comment


                  #9
                  Re: Year from Date Question

                  Without researching it more, I assume from your answer G that a Combo box drop-down has to be character?? Strange that I have not noticed that limitation until now if so.
                  Mike
                  __________________________________________
                  It is only when we forget all our learning that we begin to know.
                  It's not what you look at that matters, it's what you see.
                  Henry David Thoreau
                  __________________________________________



                  Comment


                    #10
                    Re: Year from Date Question

                    I don't use these objects much so I could be wrong on this, but something somewhere in the back of my mind tells me so.

                    Comment


                      #11
                      Re: Year from Date Question

                      Originally posted by G Gabriel View Post
                      Dim the variable as c and in your choices, using an expression, use cyear() instead of year().
                      I have yet to try this to see if it works but could you tell me exactly what you mean by "Dim the Variable as c".
                      Im guessing you mean when creating the field to select "Character" instead of "Numeric" or I could be wrong.

                      Comment


                        #12
                        Re: Year from Date Question

                        Originally posted by Scott_S View Post
                        Im guessing you mean when creating the field to select "Character" instead of "Numeric"
                        Correct.

                        Comment


                          #13
                          Re: Year from Date Question

                          Originally posted by G Gabriel View Post
                          Dim the variable as c and in your choices, using an expression, use cyear() instead of year().
                          Ok this works.
                          However now my problem is im switching to a report and im not getting any records.

                          On my button I have ONPUSH in the script genie I have.

                          Preview a layout..Records that match the value in a control on the form.
                          Filter-print records where value in field..PurchaseDate
                          matches the value in the control VarcYear

                          My guess is that its not working because its looking for a date since in my table structure Purchasedate's type is a Date. Where as the VarcYear is set as a character. ??

                          Comment


                            #14
                            Re: Year from Date Question

                            Scott,
                            Then I would try to either create another variable that matches or convert the one you are using with an expression such as --course if you are using Action Scripting(AS) then use inline xbasic to do this--I don't know if AS can do it otherwise.

                            ctod(VarcYear) to make the character variable become a date type

                            or I suppose dtoc(PurchaseDate) to make the PurchaseDate value become character
                            Last edited by MikeC; 10-22-2008, 11:47 PM.
                            Mike
                            __________________________________________
                            It is only when we forget all our learning that we begin to know.
                            It's not what you look at that matters, it's what you see.
                            Henry David Thoreau
                            __________________________________________



                            Comment


                              #15
                              Re: Year from Date Question

                              You were trying to get the year part of the date, not the entire date, to show on the drop-down object. That was your question.
                              Originally, you used numeric variable: didn't work.
                              Now, with a charcter variable: it works.
                              You are trying to take the year you select from the drop down to use it to filter the report.

                              1-First, make sure your variable (the one you usefor drop down) is either session or global. Let's call this variable: Lamat.
                              When you make a choice, the chosen value will be a character: for instance "2008" for the year 2008.
                              2-In the report, use as a filter: cyear(the date field in your table)=var->Lamat.
                              Alternatively, when using AS, I am pretty sure there is a choice to use an expression, use the same expression as above.

                              Comment

                              Working...
                              X