Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding date in range, via the web

Featured Replies

Hi there,

I want to let my user find a specific record based on a date, in a range of two dates. The field the record is based on is called 'startdatum' (Sorry, I'm Dutch...). I've copied this field into two other fields, called webstartdatum1 and webstartdatum2. I figured out that, when searching, I let users enter two dates on the HTML page. One is put in webstartdatum1 with the operator >=, the other one in webstartdatum2 with the operator <=. During search, I use the AND operator while submitting. That way I thought I let them search for anything between those two dates (sounds logical, doesn't it ?)

On the web, I use this code :

<SELECT NAME="[op]">

<OPTION VALUE="gte">&gt

</SELECT><INPUT TYPE="text" NAME="startdatumweb1" VALUE="" SIZE="22">

and :

<SELECT NAME="[op]">

<OPTION VALUE="lte">&lt

</SELECT><INPUT TYPE="text" NAME="startdatumweb2" VALUE="" SIZE="22">

Ok, so far so good.... Tried it, won't work... When entering only one of the dates, I find all records based on that date. So, I figured out, the operator-part is wrong. But I can't find out what I'm doing wrong..... Anybody got an idea ??

Thanks,

Andr

Of course what you have tried does not work. This has been regularly discussed in these forums. It does not work because the -op tag is quite useless. Although FMI claims that one can use the cdml tags with html to custom publish, they are misstating the reality. In fact, if you look at their examples, the ONLY way you can get the -op tag to work is by using the lanugage JavaScript - which is not html.

You need to consider the information available about performing an exact search. When you understand that technique, you will be able to adapt the information to using a range - or any of the other symbols found in the status bar when you are performing a find in the db.

[ September 05, 2001: Message edited by: Keith M. Davie ]

The problem is also with two fields. You must construct your request to be inserted into 1 single date field. That is not difficult, just use the values inserted into single field.

Will that be better approach in your scenario?

  • 2 weeks later...

use javascripting to validate empty based on empty's.

function valiDate(field, field2){

if(!field && !field2)

{

return true

}

else{

if(!field || !field2)

{

return false

}

}

}

(you get the general idea.)

Things unnecessary to successfully perform a find of a range in one field in a browser solution for FMPro: -op, lte., gte., JavaScript.

Right-o Keith. The javascripting would be in response to the fact that arotgans has two date fields. If they were combined into one field then a -script or a "..." range could be made.

If I understand the problem correctly, this is for some sort of project or hotel database, in which case one field is impossible without having a calc field that checks to see if the value is within the two field (then you get into the issue of a related DB just to have a new record created as they do the find which stores the value to perform the nessasary validation.)

The -op tag is not 100% useless, but it takes some playing around to work properly. The main thing that doesn't work correctly with the -op is the date field.

And I suppose then that because the -op does not work with a date range find that my earlier recommendation about understanding the exact search can lead to understanding how to use the date range may well be the best advice so far.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.