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

Cannot search list using dd/mm/yyyy date format

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

    Cannot search list using dd/mm/yyyy date format

    Alpha v12.4.5.5.0 Build 5667

    I have a list with Search Part enabled and the search style is a single keyword control
    My list contains dates displayed in dd/mm/yyyy format
    The db is MS SQL Server

    If I search for a date that is in the list using dd/mm/yyyy format I don't get any results.

    If I search for a date that is in the list using mm/dd/yyyy format I do get results even though the dates aren't displayed in this format.


    Any help on how get the search working using dd/mm/yyyy format is appreciated.

    #2
    Re: Cannot search list using dd/mm/yyyy date format

    What date format is your computer using? This should be irrelevant, but just curious.
    What date format is set in your UX "Date format" property? Probably dd/MM/yyyy.
    What is the property set to in the List column for your date, in the Fields tab, Client-side, Date/time display format? This should be set to <Default> in order to pick up the UX Date Format.

    The problem is most likely your <LIST>_KEYWORDSEARCH control. What is it's "Type" property set to? If it's Character, then change it to Date. Your search should now work using either dd/MM/yyyy or MM/dd/yyyy formats.

    With the Type property set to Date, Alpha now understands how to use the data entered into that control. If it's set to Character Alpha doesn't understand what's going on and essentially turns off the attempted filter. The returned filter information is (1=2). I'd say this is a bug in Alpha... or should I say... a non-implemented item.

    Set the search field type to Character and you can search on MM/dd/yyyy and yyyy/MM/dd, but not dd/MM/yyyy.
    Set the search field type to Date and it doesn't matter what search format you use... the search will work.
    Last edited by Davidk; 05-25-2019, 10:07 PM.

    Comment


      #3
      Re: Cannot search list using dd/mm/yyyy date format

      Thanks David,

      Computer format is dd/mm/yyyy
      UX Date format property is dd/MM/yyyy
      Client side date/time format for the field in the list is <Default> (P.S. server side format is not set to anything)

      I'm seeing a couple of problems with setting the <LIST>_KEYWORDSEARCH control to a type of Date.

      1. As this is setup to search on multiple fields setting this to Date means character searches no longer work.

      2. I still can't search using dd/mm/yyyy format unless the dd/mm portion contains values that aren't ambiguous i.e. unless the dd part is above 12. As an example, if my list contains a value of 24/01/2019 I can search and find a result using either dd/mm/yyyy format or mm/dd/yyyy format. However if my list contains a value of 11/08/2019 searching for this only works if 08/11/2019 is entered in the search field.

      For the moment I'm stumped.

      Comment


        #4
        Re: Cannot search list using dd/mm/yyyy date format

        I think you'll need to get Alpha to explain this one. Dates are always horrible to work with. Alpha makes this better by some of the functions they provide... and more wretched by making giving us a number of formatting options and not explaining how they with each other... or against each other.

        It seems that Alpha is not paying attention to formatting options selected when a search is performed. Alpha is taking the search value and applying it, formatted, against the data... and so you do not get results. They are recognizing that you're searching against a date... but they are not looking after the value input.

        Much of Alpha isn't fully implemented... and I think this issue falls into that category. This is the debugging info for a search...

        Date_Search.PNG

        Note that custdate1 is a date argument... and it's value is 10/11/2019 (dd/MM/yyyy). Alpha, in recognizing the date field, should understand what format you're providing... and then turn that into whatever format they are using internally so that SQL can understand it. Alpha never tested the Search feature with a date format other than their own... MM/dd/yyyy.

        I can see how they are getting it wrong. The trick is for you to explain it to them so that they'll understand.

        Comment


          #5
          Re: Cannot search list using dd/mm/yyyy date format

          There is a way to get this to work... but you'll need to use the UX method {dialog.object}.computeSearchFromMetaDataAndFilterList(). Essentially you're setting up the search... and so you get to format the date properly for SQL in a yyyy-MM-dd format.

          Comment


            #6
            Re: Cannot search list using dd/mm/yyyy date format

            I reported this to Alpha and they said "we will look into adding support for date fields in a keyword search".

            Comment


              #7
              Re: Cannot search list using dd/mm/yyyy date format

              For what it's worth, I typically use the time() command to force dates to a single
              format and then do my comparisons/searches.
              Gregg
              https://paiza.io is a great site to test and share sql code

              Comment


                #8
                Re: Cannot search list using dd/mm/yyyy date format

                Gregg, could you elaborate on that please?

                Comment


                  #9
                  Re: Cannot search list using dd/mm/yyyy date format

                  Sorry about the delay. It took a bit to dig up the best explanation.
                  In the image below, the date chosen using the date picker was June 6, 2019.
                  As you can see, Alpha Anywhere converted it from dd/MM/yyyy to MM/dd/yyyy.
                  I am guessing this is the initial cause of your problem.
                  I manually converted the date to iso8601 format (yyyy-MM-dd) so that any ambiguity
                  would be eliminated.
                  I didn't see if you're using sql or dbf, but in my experience, based on past trial and error,
                  converting to the iso8601 format saves lots of headaches when it comes to searching, sorting,
                  and comparing date values, and from what I know, sql prefers the ISO8601 date format.

                  2019-05-29_14-01-41.png
                  Gregg
                  https://paiza.io is a great site to test and share sql code

                  Comment


                    #10
                    Re: Cannot search list using dd/mm/yyyy date format

                    Cheers Gregg.

                    Alpha today advised me that this has been fixed and will be in the pre-release build which will be available around 30th May 2019.

                    The fix relates to date searches in a single keyword control for a list that has a search part defined.

                    Comment


                      #11
                      Re: Cannot search list using dd/mm/yyyy date format

                      Here's a solution using {dialog.object}.computeSearchFromMetaDataAndFilterList(). This is essentially the same as using .searchList(), but you get more control... and therefore you can fix the bug yourself if you want to.

                      Code:
                      var searchValue = {dialog.Object}.getValue('LISTCUST_KEYWORDSEARCH');
                      var dateValues = searchValue.split('/');
                      
                      if(dateValues.length != 3){
                      	//not a date
                      	var searchCV = searchValue;
                      }else{
                      	//we have a date
                      	//now... reformat it to something SQL can use
                      	var searchDate = new Date();
                      	searchDate.fromFormat(searchValue,'dd/MM/yyyy');
                      	var searchCV = searchDate.toFormat('yyyy-MM-dd');
                      }
                      
                      //now build up the array of columns to search against
                      var arr = [];
                      var searchObject = {
                      	searchControlValue: [searchCV],
                      	searchField: 'CUSTDATE'
                      };
                      arr.push(searchObject) //you can push multiple searchObjects onto the array
                      var searchObject = {
                      	searchControlValue: [searchCV],
                      	searchField: 'FIRSTNAME'
                      };
                      arr.push(searchObject) //you can push multiple searchObjects onto the array
                      var searchObject = {
                      	searchControlValue: [searchCV],
                      	searchField: 'LASTNAME'
                      };
                      arr.push(searchObject) //you can push multiple searchObjects onto the array
                      
                      var searchDataJSON = JSON.stringify(arr);
                      //set up options for the search
                      var options = {
                      	combineMultipleConditionsWith: 'OR', //(optional) if multiple search fields are specified should the conditions be combined with 'AND' or 'OR'. defaults to 'AND'
                      	debugging: true, //(optional) should debugging information be shown? defaults to false.
                      	div: 'PLACEHOLDER_1' //if debugging is true the name of the PLACEHOLDER control where the debugging information should be shown.
                      }
                      
                      var optionsJSON = JSON.stringify(options)
                      {dialog.object}.computeSearchFromMetaDataAndFilterList('LISTCUST',optionsJSON,searchDataJSON);

                      Comment

                      Working...
                      X