Jump to content

This topic is 8421 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I had originally planned to post some useful code which directly answers the currentdate matter raised by Turansky. I have spent the past half-hour getting rejects to this posting because of code problems around a parenthesis and html (or perhaps several parentheses). I have no idea what the problem is. I have tried to contact [email protected] from the link at the bottom of this page, but that address was rejected by Netscape.

So I guess research is good for the soul, and I will be doing some research to see if I can figure out how to post code which should be of benefit to many people.

Posted

You're not alone. It's a bug in the UBB software. I complained earlier to no avail. Try posting this without UBB code tags:

code:


<(

This is a common occurance in calculations. For example:

code:


If(a < (b + c), "true", "false")

Posted

currentdate-Research is good for the soul.

The following contains some instruction which any newbie can use to learn something about html/cdml. I am hopeful that they will also learn something about being a FileMaker developer.

This thread arises from the thread started Jan.18, 2002 by Turansky entitled, "Current Date Explanation".

In immediate response to Turansky's original query I responded with the advice that research was good for the soul and a starting reference. If you are not familiar with this citation see my first contribution under Turansky's thread and USE THAT LINK. You will save yourself time.

You would be well advised also to have some basic reference books at hand. Titles to these have been posted elsewhere but here they are once again. "FileMaker Pro 4 Companion" by Maria Langer; "FileMaker Pro 4 and the World Wide Web", by Jesse Feiler; and "Database Publishing with FileMaker Pro on the Web", by Maria Langer. You would be well advised to devote the time necessary to read these three books cover-to-cover. Then you will find referring to them to be much more useful.

Knowing what to trouble-shoot is necessary to your success. Look again at Turansky. He thought he had a date formatting problem and went down a path of creating a calculation field. This process took him six days. He could have read at least one of those books in that time. Had he chosen Feiler he would have found -p. 237-, "Note that the actual formatting of dates and times is governed by the options set in the control panel for the computer on which Web Companion is running...".

Bingo! That means you do not need to create a calculation field for today's date. Know your OS. If you are hosting on a Mac, go to Control Panel / Date&Time. Select Date Formats. Select Show Century. Your date should be formatted as mm/dd/yyyy or dd/mm/yyyy.

Ok. That knowledge eliminates the need for a calculation field. A little research would have revealed that. Having read the book, I knew where to look. Read the books folks.

But how does one recognize that problem in the first place? Knowing how to trouble-shoot is also necessary to your success.

Let's say that you have your db and format files and you test the -find action via your browser -and you have not formatted your field and/or OS correctly. You get a broswer message that the format file could not be found. Don't panic. Look at the db file. Does it show No Found records? If so, that means that data was entered but the data produced no results. Working directly in the databasae, cancel the find if necessary. Use the "Modify Last Find" command/Apple-R directly in the db. That will show you the data which was entered in the field via the web. Cancel the request and make your necessary adjustments to the format files or the db file. Knowing what data was successfully entered allows for understanding. HINT: if you are a newbie who tries the following code and everything works, go to the db file after you get your success page and do a "Modify Last Find" in the db. You will see what the data, properly formatted, looks like. Cool lesson.

To demonstrate how easily the find can be performed when your OS is properly formatted and your fields are properly formatted, I have gone to the effort to provide a useful demonstration for those interested.

I took the line of code which Turansky provided in his first query. From that I constructed a db named events.fp5. It has one field named expire, which is formatted as a date field set to display the date mm/dd/yyyy -which agrees with the structure of the captured fmp-currentdate, which is dependent upon the settings of the OS. I then created a dozen records with a variety of past, current and future dates. Clearly from the code of Turansky's first posting he was interested in accessing all records dated with today's date or in the future, but not yesterday or any day prior thereto.

Next I created a default.htm, from which to activate the db with a -findall and access a format file from which to perform the -find. Then I created page.htm which is the format file from which the find action -based on Turansky's original code- will be initiated. Then I created success.htm, the results page.

This was easily done using html/cdml with NO SPECIAL CALCULATION FIELDS, NO JavaScript, AND NO NEED TO USE THE -op OR -lop TAGS. And it worked as I intimated it would in my original post under Turansky's thread.

The code for this particular search is written correctly. Mac users are advised to avoid the "option/shift/<" and write this out as shown below. In the future one can replicate this code and edit as necessary. It is worthwhile to understand the characteristics of the exact search as I earlier indicated. That understood, the rest of the find symbols come easily. Research is good for the soul. Do your soul a favor. Read the articles referenced under the Turansky thread cited above.

The database setup is described above. You can try this yourself. Set your Web Security accordingly. The format files page.htm and success.htm I placed in the folder "turansky" along with the db in a folder "databases"*.. This was placed appropriately in the FMPro 5. folder Web. And default.htm was placed loose in the folder Web. The db and a browser were opened and tested. Everything worked as it should.

*Note. For on-line web publishing you would want to place your folder "databases" outside the folder "Web", even though the data of the fields can still be forced.

This solution was easily accomplished using html/cdml with NO SPECIAL CALCULATION FIELDS, NO JavaScript, AND NO NEED TO USE THE -op OR -lop TAGS. And it worked as I intimated it would in my original post under Turansky's thread.

The pertinent code from within the < body - /body > tags follows for those interested enough to copy and paste: Use the .fp3 extension for FMPro 4.. In addition to the code for an action link, I am also providing on page.htm the code for a form action. It is good to have working choices.

Note, there should be breaks or these lines should be placed in tables. I have removed punctuations such as most pointy brackets in order to post this. Sorry for those who would like to copy and paste. I wanted to post it that way.

Within the body of default.htm:

<a href="turansky/fmpro?-db=events.fp5&-format=page.htm&-max=all&-findall">Fools enter here</a>

Within the body of page.htm:

found: [fmp-currentfoundcount]

total: [fmp-currentrecordcount]

today is: [fmp-currentdate]

Turansky's find action edited to work properly:

<a href="fmpro?-db=events.fp5&-format=success.htm&expire=>=&expire=[fmp-currentdate]&-find">Fools click here</a>

form action="fmpro" method="post"

input type="hidden" name="-db" value="events.fp5"

input type="hidden" name="-format" value="success.htm"

input type="hidden" name="expire" value="<="

input type="hidden" name="expire" value="[fmp-currentdate]"

input type="submit" name="-find" value="I'm A Fool"

/form

Within the body of success.htm:

found: [fmp-currentfoundcount]

total: [fmp-currentrecordcount]

today is: [fmp-currentdate]

Research is good for the soul. Understanding the techniques of the exact search as discussed in the referenced articles allows one to understand the ability to use the other FMPro provided symbols of a database "find" action in html/cdml code. Clearly a much simpler approach than creating an unncecssary calculation field and using an unnecessary logical operator tag. and/or unnecessary JavaScript. Knowledge is power.

Posted

quote:

RE: "Note that the actual formatting of dates and times is governed by the options set in the control panel for the computer on which Web Companion is running...".

Bingo! That means you do not need to create a calculation field for today's date. Know your OS.


Not realy in all cases. WC is receiving data always in the same US format regardless of local settings.

[ February 07, 2002, 07:21 PM: Message edited by: Anatoli ]

Posted

What happens if this is on the first page and has not yet been processed by FMWC; as was the case with Turnansky?

quote:

Turansky's find action edited to work properly:

<a href="fmpro?-db=events.fp5&-format=success.htm&expire=>=&expire=[fmp-currentdate]&-find">Fools click here</a>

So how do you place the current date into the URL/Form? You can use Javascript. As an alternative, you can create a simple calculated field which indicates the condition for which the search is intended.

Simple. Once you know the problem! wink.gif

All the best.

Garry

[ February 07, 2002, 07:51 PM: Message edited by: Garry Claridge ]

Posted

Garry inquires, "What happens if this is on the first page and has not yet been processed by FMWC; as was the case with Turnansky?"

A "first page" requirement was not in Turansky's original post or line of code. The items to which my response was directed were described in Turansky's original post.

I am not sure what Garry means by "first page". If he means default.htm then he is correct in that no db has been accessed. If he means any page after default.htm,then there is no excuse for not accessing a db.

In this regard, I have not experimented with a meta refresh for the default.htm. If that were to be effective then a db could be accessed in the first page available to the client.

Peace and love.

Posted

quote:

A "first page" requirement was not in Turansky's original post or line of code

That's why a "Wild Goose Chase" followed. Vaughan was the first to pick-up on this. It is a good lesson, because with any similar question (replacement tag being passed with a URL) it is now wise to ask if the page has been processed by FMWC.

All good fun. smile.gif

Garry

Posted

As a general rule, if a Forum thread continues for more than about six posts, then either: 1) the topic has strayed from the original question; or 2) something really basic or "dumb" has been missed really early-on and we're not getting anywhere near the answer. You can call this "Vaughan's Law" if you like. wink.gif

Most threads fit a profile of: question / request for clarification / clarification / answer / alternate answer or improvement.

That is, unless somebody mentions running scripts over the web, Windows 2000 or TODAY... then all hell breaks loose!

Posted

Rather than argue theory I experimented. Took less than five minutes.

For those interested. Do not put anything in the body of the suggested default.htm. Instead, within the head tag insert enclosed by pointy brackets:

meta http-equiv="refresh" content="0;url=turansky/fmpro?-db=events.fp5&-format=page.htm&-findall"

You will get the fmp-currentdate on the first page accessed, page.htm.

Posted

... or -FindAny which technically might be a bit faster.

Posted

Garry, "You can use Javascript."

Yes, you can. JavaScript is a wonderful language which has many uses. However for some things it is completely unnecessary.

Yes, I did ask about the nervous finger. And yes, JavaScript was the answer because html/cdml could not handle the problem.

Still, this is the cdml forum. Thus, if a question can be answered in html/cdml I feel that answer should be addressed in that manner.

Clearly as far as I can see a calculated field is totally unnecessary to the solution as long as your OS is properly formatted.

Posted

Ok, I have checked the point Anatoli made about FMPro not formatting the date properly. I reset my OS such that it displayed the date in the European format (dd/mm/yyyy). The fmp-currentdate appeared properly formatted (European) on page.htm. However, when used in a find FileMaker does enter the fmp-currentdate strictly in the American date format of mm/dd/yyyy, creating havoc with Euro dating techniques.

I stand corrected on that point.

However, reviewing Turansky's original post he clearly states that he is using the American date format, "The data in the field looks like this:01182002 mmddyyyy". He just did not have slashes.

In any event, for American formatted dates such as Turansky's the simple solution I have posted above is valid and requires no JavaScript, no calculation fields and no lop.

For the Euro solution since a field can be created as a date, calculation=Today, and that date can be formatted to Euro standards, I suppose that field could be used in the find. I know I could do it safely with a script, though it can probably be creatively coded for use in a find.

[ February 08, 2002, 06:16 AM: Message edited by: Keith M. Davie ]

Posted

To clarify the problem with the 'rest of the world' date format.

I am using 5.5v2 on OS X. If I create a database with 5.5 and write a date to it, eg 31/1/2002 this works fine. However, if I have a database created with 5.0 and I am using 5.5 and attempt to write the same date the error occurs. I think the same thing was happening with WinNT.

We had a couple of threads on this about mid last year. Interesting dilemma.

Garry

This topic is 8421 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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