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

convert to date

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

    convert to date

    Im sending a report to open in pdf.
    Im trying to filter the data depending on the date i select.
    "Pickup_Date" is the field i want to use as a filter.
    i get this error when i try to execute it:

    Errors in: event.AfterValidate code:
    Invalid report filter expression: 'Pickup_Date = "03/14/2005"'.

    Help.
    "-----------this is the code-----------"
    dim filter as C
    dim order as C
    dim invnum as C
    dim filename as C

    'since InvoiceNumber is a multi-select DropDownBox, it is actually an array that contains the selected values.
    invnum = invoiceNumber.dump()
    invnum = remove_blank_lines(invnum)
    invnum = *for_each(x,"Pickup_Date = " + quote(x),invnum)
    filter = stritran(alltrim(invnum), crlf()," .or. ")
    Order = ""

    filename = session.session_folder + chr(92) + "tempreport.pdf"

    filename = report.saveas("pickup@"adb_path"\order_all.set", "pdf", filter, order, filename,.f.)
    if file.exists(filename)
    currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + rand_string(5)
    end if
    Skipreport:

    #2
    RE: convert to date

    'Pickup_Date = "03/14/2005"'

    is not valid because pickup_date is (presumably) a date field and "03/14/2005" is a character value.



    Pickup_date = "{" + "03/14/2005" + "}"

    is a valid expression because date values in a5 are enclosed in "{}". e.g. {1/1/2005}

    if your date value is a variable, called say whatDate, then the filter is:

    pickup_date = "{" + whatDate + "}"

    Comment


      #3
      RE: convert to date

      Selwyn,
      Where exactly would i put that code?
      i've tried this:
      invnum = *for_each(x,"Pickup_Date = " + quote(x),"{"+invnum+"}").
      but it doesn't work.

      Andy.

      Comment


        #4
        RE: convert to date

        You need

        invnum = *for_each(x,"Pickup_Date = " + quote("{"+x+"}"),invnum)

        Lenny Forziati
        Vice President, Internet Products and Technical Services
        Alpha Software Corporation

        Comment


          #5
          RE: convert to date

          Selwyn,

          If I want to use this for my dutch settings on a WAS server that has (for me) unknown date setting, can I than "denationalize" this, f.i. using the ctod() function or so?
          (still fighting against national standards....)


          Greetings, Ren�
          Ren�
          Windows 7, V11

          Comment


            #6
            RE: convert to date

            you could use this function to get the date format on the server:

            ? a5_get_local_info(1024,31)
            = "M/d/yyyy"

            Comment


              #7
              RE: convert to date

              Thanks, but this doesn't help much.
              Here's the situation:
              On my local development station I define (in Windows) date as dd-mm-yy. In A5 I cannot find a place where I can define the date format. Neither in table structure or fields rules or in view,settings or in database settings.

              In the Grid Builder, when I change nothing, the date will be displayed the Windows way, in my case: dd-mm-yy or dd-mm-yyyy.

              Now I host the database on the alpha5host.com site. There the default date format is mm/dd/yyyy.
              By setting the display format in the grid fields to time("dd-MM-yy","value"), I can force the WAS to display dd-mm-yy.
              BUT: when I define a Search field, I must enter the mm/dd/yy format, else the search won't work. I cannot find a way to neutralize this.
              I think I managed my built in filters by using cdate(Fieldname).

              So: the Search in grids is still a problem because I don't see a way to translate the dutch search command dd-mm-yy into a US internal search command.

              Ren�
              Ren�
              Windows 7, V11

              Comment


                #8
                RE: convert to date

                I still get the same error.

                Andy

                Comment


                  #9
                  RE: convert to date

                  Since you are doing other things to the filter as well, I would suggest looking at the final value just before your report.saveas(). Try adding something like

                  save_to_file(filter,"c:\filter.txt")

                  Then look at the contents of that file after running your code.

                  Lenny Forziati
                  Vice President, Internet Products and Technical Services
                  Alpha Software Corporation

                  Comment


                    #10
                    RE: convert to date

                    I followed Lenny's tip, to create a text file:
                    save_to_file(filter,"c:\filter.txt")

                    the content was:
                    Pickup_Date = "{03/14/2005}"

                    its still invalid, how to i go from that, to what selwin suggested in earlier comments, this:
                    Pickup_date = "{" + "03/14/2005" + "}"

                    Andy.

                    Comment


                      #11
                      RE: convert to date

                      You need
                      invnum = *for_each(x,"Pickup_Date = " + "{"+x+"}",invnum)

                      You don't need the quote() function unless Pickup_Date is a character field.

                      Comment


                        #12
                        RE: convert to date

                        Thanks Peter, that worked. One last question about this matter, how come when i submit the form i have to reload in order to see the pdf file?

                        Andy.

                        Comment


                          #13
                          RE: convert to date

                          Try response.redirect() instead of currentform.redirectTarget(), but I don't know if that will make a difference. I don't know why you have to reload.

                          Comment


                            #14
                            RE: convert to date

                            It didn't work, it just reloaded to the same page.

                            Andy.

                            Comment


                              #15
                              RE: convert to date



                              I have thought of a solution to the problem you have mentioned.

                              To summarize the problem, you have a grid with a search component. The search component has a date field.
                              The WAS server is located on a machine where the regional settings are set for US dates (i.e. MM/DD/YYYY)
                              The Users, however, wants to search using date formats of DD/MM/YYYY


                              Here is how you can solve the problem.

                              You need to edit the .a5w page that displays the component.

                              Assume that your component name is "grid1" and that the date field is called "date1"
                              Note that component name is actually set in this code block with the command
                              with tmpl
                              componentname = "grid1"
                              end with

                              Switch to source mode.
                              In the "%A5 codeblock that loads the component, you need to add this code BEFORE the component is actually run


                              if eval_valid("grid1_s_date1") then
                              if grid1_s_date1 "" "" then
                              grid1_s_date1 = "" + date_value(val(word(grid1_s_date1,3,"-")),val(word(grid1_s_date1,2,"-")),val(word(grid1_s_date1,1,"-")))
                              end if
                              end if


                              The way this code works is as follows:
                              if the user clicked the search button, then variables are submitted with the page. the variable names of the form:
                              componentName_s_fieldname

                              if the user entered a value in the search field, it will be non-blank and will look like (say) 31/12/2005

                              you need to intercept this and change it to 12/31/2005 before the grid component sees it.

                              this is what the above code does.

                              Comment

                              Working...
                              X