Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

editing particular field

Status
Not open for further replies.

king117

Programmer
Dec 16, 2002
3
US
Hi,
My problem may be simple,b'cos i am new to filemaker.
My problem is..
I have many records like office hrs for each semester.
what i have to do is i will only give permissions for present semester record.That is when user enter edit button it will only give present sem record for editing.
for this one i have a field name semcode.That is it has year and semester.for example 031(for 2003 spring).
Now i ahve to check present year and semester(depending upon month) with this semcode,i have to find present sem record.
Any can give me source code for this checking function
thanks in advance...
 
Hmmmmm... If I'm understanding you correctly... Here are my thoughts:

Your problem centers around filtering the database through a find. But how to do it? You could certainly manually enter the unique quarter code ("031") each time for the search, but why bother when you could automate it?

I would set up an opening script and use the Edit -> Preferences -> Document to set up the call to the script. Then create a new script called "Opening parameters," or something like that. Set up a sub-script call in the opening script to the new script (unless you want to pack all of this into the opening script). Create a global field called CurrentQuarter, or something like that.

The Opening Parameters script should go something like this:

If ["Month( Status( CurrentDate) ) = 1"]
Set Field ["CurrentQuarter","Right( Year( Status( CurrentDate) ) , 2 ) & "1""]
Else
If ["Month( Status( CurrentDate) ) = 2"]
Set Field ["CurrentQuarter","Right( Year( Status( CurrentDate) ) , 2 ) & "1""]
Else
If ["Month( Status( CurrentDate) ) = 3"]
Set Field ["CurrentQuarter","Right( Year( Status( CurrentDate) ) , 2 ) & "1""]
Else
If ["Month( Status( CurrentDate) ) = 4"]
Set Field ["CurrentQuarter","Right( Year( Status( CurrentDate) ) , 2 ) & "2""] (*See the difference?)

... and so on 'til you reach 12 (December)

Then, for your button format, "Edit," select 'perform script'. Have a script ready called whatever you want that does the following:

Freeze Window
Show All Records (<- You may or may not want this step)
Copy [Select,&quot;CurrentQuarter&quot;]
Enter Find Mode []
Paste [Select,&quot;Field_That_Has_Unique_Date_Identifier_You_Described&quot;]
Perform Find [Replace Found Set]

*Poof*

You now have only the office hours for that quarter in front of you, in browse mode, nonetheless.

Everything I provided *should* work... but my If/Else/End If structure might be flawed. I haven't brushed up on their proper syntax in a while... but everything else should be good to go.

Cheers,

-Ansel

 
Boy! Ansel, you like to make things difficult.
Your initial script would be better(?) handled with Case.
I think this is simpler and quicker(?)
set field[&quot;CurrentQuarter&quot;,
&quot;Right( Year( Status( CurrentDate) ) , 2 ) & ( (Int(Month(Today)/4) + 1)&quot;]

Even simpler is just one script -
Enter Find Mode [no Restore or Pause]
Set Field[&quot;SemCode&quot;,
&quot;Right( Year( Status( CurrentDate) ) , 2 ) & ( (Int(Month(Today)/4) + 1)&quot;]
Perform Find (Replace Found Set)

Any reason you use <Status(CurrentDate)> instead of <Today> ???
There is an issue with operations running over midnight on the last day of the quarter but neither of our solutions covers that.
Cheers,
Paul J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top