Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hello all. Happy 2012 !! I am a newbie, and have been searching for a solution to my problem unsuccessfully so far. I am hoping someone can help me with my problem. I am using FM Pro 11 to create my databases to use in FM GO for Ipad. The database I have has a field called "Notes" which I use to track general information as I receive it. I have created a script that allows me to insert the current date and time into my notes field before I start inputting my notes.

InsertCurrentDate[] does the trick to insert the current date, but it is not the format that I need. It inserts "08/01/2012" But I need it to insert the date in the format of " Sun 8 Jan, 2012"

An example of what I am trying to acchive:

I make a telephone call. There is no answer. I press my "N/A CALL" button, and my script will insert the day, date and time of my call into my "notes" filed, then off to the next call i go. So, my "Notes" filed might look something like:

08/01/2012 @ 7:51am. Called. No answer. - But I need it to read: Sun 8 Jan, 2012 @ 7:51am. Called, No answer.

I am sure there is a very simple solution that I am overlooking, but I would sure appreciate some help.

Posted

Hi there, welcome to the forums - since you are using FMP client and not Advance you can't take advantage of a custom function - however the same calculation can be used in a script or calculation..

Left ( DayName ( Get(CurrentDate) ) ; 3 ) & " " & Day ( Get(CurrentDate) ) & " " &

Left ( MonthName ( Get ( CurrentDate ) );3 ) & ", " & Year ( Get ( CurrentDate ) ) & " @ "  & Get (currentTime) &" " & Get(ScriptParameter)

You can pass a parameter on a button such as "Called, No answer." and use the same button for different actions using this in a Set Field Script Step.

You may also wish to set the field to : List ( <the calc> ; MyNoteFIeld ) this way it will build up your note field. and the most current note is at the top..

(note this will include seconds if you wish to omit seconds it would take a few more parameters.)

Posted

here is one that will work better - in that it uses Get ( CurrentHostTimestamp ) this way if your FMGo app is using a hosted version the time stamp is that of the server, multiple users will

all be in sync.




Let ( [

gcd = GetAsDate ( Get(CurrentHostTimeStamp) ) ;

gct = GetAsTime ( Get(CurrentHostTimeStamp) ) ;

dn = Left (DayName ( gcd ) ;3 )  ;

d = Day ( gcd )  ;

mn = Left ( MonthName ( gcd ) ; 3 ) ;

y = Year ( gcd ) ;

h = Hour ( gct ) ;

m = Minute ( gct ) ;

ap = Filter ( gct ; "AMP" ) ;

n = Get ( ScriptParameter );



//this evaluates the time stamp to be Sun 8 Jan, 2012 @ 8:53 AM - Your Script Parameter Value.

stamp = dn & " "  & d & " " & mn & ", " & y & " @ " & h & ":" & m & " " & ap & " - " & n



] ;



List ( stamp ; YOUR_NOTE_FIELD )



)

Posted

The database I have has a field called "Notes" which I use to track general information as I receive it.

IMHO, it would be much better to have a separate record for each note in a related table - and enter the date (or timestamp) into a dedicated field which can then be formatted to your liking.


gct = GetAsTime ( Get(CurrentHostTimeStamp) ) ;

...

ap = Filter ( gct ; "AMP" ) ;

I don't think you'll find any of "AMP" in the result of GetAsTime().

Posted

as usual comment i am humbled - (and totally agree!) My excuse - I didn't have my morning coffee yet when posting, couldn't see the forest thru the trees - Now that I have been caffeinated :hyper: I too would recommend a separate table for notes - one record for each note instance.

Posted

Thanks so much for your fast response. Excellent. Worked like a charm. I used the first option. What do I need to do to get rid of the seconds?

You said -------"You may also wish to set the field to : List ( <the calc> ; MyNoteFIeld ) this way it will build up your note field. and the most current note is at the top" -------- This is exactly what I want to do. My notes field is called "Notes" How do I perform your above instruction? Here is my completed script so far below. Now when I press the NA button, the script runs, but I have to make sure the cursor is at the beginning of my "Note" Field, otherwise everything gest replaced by the new date, instead of adding to it. THANKS so much for your help!!

Go to Field [ Contacts::Notes ]

Insert Calculated Result [ Left ( DayName ( Get(CurrentDate) ) ; 3 ) & " " & Day ( Get(CurrentDate) ) & " " &Left ( MonthName ( Get ( CurrentDate ) );3 ) & ", " & Year ( Get ( CurrentDate ) ) & " @ " & Get (CurrentTime) &" " & Get(ScriptParameter) ]

Insert Text [ " - No Answer / " ]

Go to Field [Contacts::Date of Last Contact ]

Insert Current Date [ ]

Go to Field [ Contacts::Call Result ]

Insert Text [ "No Answer" ]

Go to Field [ Contacts::Contact Status ]

Insert Text [ "N/A TRY AGAIN" ]

Posted

i re uploaded file as the original one may had been zipped when while it was still open

Posted

Thanks Stephen. I tried again, but still no luck. Doesnt give me the option to see the script or modify the record. I like what I see though. Only thing is I have many hundreds of records that already have my NOTES field populated with a lot of text already. How would I integrate my existing notes with your newley created notes field if I can get it to work?

In the meantime, how can I deal with my original :

You said -------"You may also wish to set the field to : List ( <the calc> ; MyNoteFIeld ) this way it will build up your note field. and the most current note is at the top" -------- This is exactly what I want to do. My notes field is called "Notes" How do I perform your above instruction? Here is my completed script so far below. Now when I press the NA button, the script runs, but I have to make sure the cursor is at the beginning of my "Note" Field, otherwise everything gest replaced by the new date, instead of adding to it. THANKS so much for your help!!

Posted

the database is unlocked no permissions - you can't open script the scripts or define fields?

I am not sure why you can't see or edit the script.

notesSample.pdf

here are the scripts I created in PDF version

Posted

Get Info on the file. It sounds like the file is "Read Only" which happens on Windows sometimes. I downloaded the original file, and was able to open the scripts without problems

Posted

Thanks guys. I got it working now.

I have many hundreds of records that already have my NOTES field populated with a lot of text already. How would I integrate my existing notes with your newly created notes field if I can get it to work? I Like your "Field Method" and middle "Record method"

This is exactly what Im trying to acchive, I just have to figure out how to integrate it into my existing database.

Posted

as long as each note is is in its own line and very consistent to how you described it then a structure script could loop thru each record and each line and explode it out into a table. and some cleanup would be needed to split out date / time / note etc.

alternatively

If the original note field is free form and not structured your could find all records that have notes - then import these records (ID / Note Field) in to the notes table the ID would match to the foreign key ID field in the note file. It would be a seed value note that contains all previous notes to this point gong forward new notes would be a separate record.

This topic is 4760 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.