Jump to content
Sign in to follow this  
stevehar

Log Field Syntax?

Recommended Posts

stevehar

I have the need for a “note” field for contact managment records in an FP7 application that has entries in a log field that look like:

 

-July 09, 2004 Steve: Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

 

-June 09, 2004; Steve: Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

 

Where each entry begins with the same stuff

a dash mark,

today’s date,

person’s first name who logged in is the one making the entry,

about a paragraph of text

 

And where entries

are reverse chronological

do not erase previous entries,

are separated from the previous by a line space,

are unlikely to exceed 20-30 paragraphs.

 

 

Care to share a procedure or source to do this?

 

 

Steve Harrington

A bright evening in New York City [but a slow Fp7 student]

Share this post


Link to post
Share on other sites
LaRetta

Hi Steve! Welcome to the Cafe' smile.gif

 

You need two fields. Your Note field and you need a LogField (text).

 

The LogField will have an Auto-Enter by calculation. Be sure to unclick right below 'Specify' the box 'Do Not Replace Existing Value.' In this example, because I don't know where the name is coming from, I will use the User Account Name. Then enter this calculation:

 

"- " & Get(CurrentDate) & " " & Get(AccountName) & ": " & Note & "¶¶" & LogField

 

Every time something is changed in this field, it will update the LogField with the new 'revised' entry. smile.gif

 

Also, I have found it looks bad (and is more difficult to read) if the User has entered paragraphs in their Note, so for the LogField purposes alone, I strip them. If you wish to do so (you can play with both ways to see how it displays if they enter a paragraph), you would adjust the calculation to something like:

 

"- " & Get(CurrentDate) & " " & Get(AccountName) & ": " & Substitute(Note; ¶; " ") & "¶¶" & LogField

 

LaRetta

Share this post


Link to post
Share on other sites
stevehar

Thanks LaRetta for your quick response. Your procedure looks great. I will try it both ways.

Stevehar

Share this post


Link to post
Share on other sites
coolfile

Hello everyone

 

just to add something to the brillant LaRetta in case of the note field is emty:

 

 

If ( IsEmpty ( Note );Logfield; "- " & Get(CurrentDate) & " " & Get(AccountName) & ": " & Substitute(Note; ¶; " ") & "¶¶" & Logfield)

 

Thanks

 

Coolfile

Share this post


Link to post
Share on other sites
LaRetta

Hi Coolfile! laugh.gif

 

Thanks for the adjustment, although I'm unsure whether this would produce the results desired by most audit-log processes. By adding the IsEmpty(), if the Note text was deleted, it would not trigger who deleted it or when - which is usually important in audit tracking or field history.

 

If nothing is ever entered into the Note - even if they click into the field and back out, the LogField calculations presented will not trigger a blank entry.

 

I suspect you felt the need to add the IsEmpty() because it was triggering a blank entry even when you simply clicked into the field? If so, it triggered because you unclicked (from within the calculation dialog) the lower box 'Do not evaluate if all referenced fields are empty.' This would indeed trigger a blank entry just by clicking into the field.

 

I did not mention this setting in my original post because the field creation itself would default with this clicked - as it should be. I guess I should have specified this in my original post just for clarity. wink.gif

 

LaRetta

Share this post


Link to post
Share on other sites
harryglos

You go girl! This is great information because it shows not only the "do's and don'ts" but the logic behind it! So often we give an answer that tells "what to do", but not the logic behind it so they can both understand it and have a shot at doing it on their own, later!

 

Good goin guys...

 

Harry

Share this post


Link to post
Share on other sites
harryglos

Thanks Ted,

 

Your degree of Political Correctness is simply under-whelming... : smile.gif And you say you're not related!

 

Harry

Share this post


Link to post
Share on other sites
coolfile

Hello LaRetta

 

Thanks for the comments but my tests have shown different results from that you were saying :-/. But, if we need the take in consideration all the user’s actions, nothing is best as a little button and a script.

 

Regards

Share this post


Link to post
Share on other sites
LaRetta

Hey coolfile! smile.gif

 

Because you were willing to play with the concept and not assume anything, it was brought to my attention that I should have mentioned the 'Do Not Evaluate ...' in the calculation box. I really appreciated that!

 

I believe there is something to what you are saying and I want to find out how you are getting different results - because that is very important input. I've uploaded a demo. Maybe you could help me pinpoint the differences between our two files?

 

LogField

 

Coolfile said ... if we need the take in consideration all the user’s actions, nothing is best as a little button and a script.
A solution which doesn't require a script (but acts directly upon field change) seems better than expecting a User to click a button. After all, the purpose of a history or audit track is not to depend upon User action; particularly if their action is something unwanted. I doubt they would then click a button to notify Management. I can't even get them to always click a button to turn in their time cards (even when they know they won't get paid without it). :eek: So I use an event-trigger plugin for it.

 

I'm just learning FM along with everyone else and I never assume I have all the answers or that I'm always right, because I certainly am not. There is more in Heaven and Earth than what I know! :rolleyes:

 

Thanks for hanging in there with me on this and particularly for being up-front about it! laugh.gif

 

LaRetta

Share this post


Link to post
Share on other sites
coolfile

Hi There,

Hi there,

 

We are all here to learn more, as you said; help from a "triggering" action would be handy.

 

An old friend use to say, "pretend that all users don't use their second hand".

 

Seen your file, that also my file, so even different continent, we still got the same result,

Techniques are the way they think and to whom they develop,

 

Nothing wrong about what you said, Thanks for hanging there as well, all the best

 

:-)

Share this post


Link to post
Share on other sites
SurferNate

Very cool,

 

I'm going to play the town idiot here and chime in. I used a technique from CobaltSky that is really short. I'll just copy my stickies note below with my (self directed) thoughts.

 

____________________________________________________________

Concatenated notes field: This works because FMP will allow a circular reference and get the contents of the self referencing field BEFORE completing and entering the calculation into the same field. In theory, it is possible to self reference a field for circular calculation (if my understanding is true)

 

NoteLog=

Get(CurrentTimeStamp) & " - " & NewNote & "¶" & NoteLog

 

NewNote=

Case(NoteLog;"")

____________________________________________________________

 

Any comments would be really appreciated.

 

Also, in due deference to LaRetta, I used your neat little field background trick in my project too. I did however trim the calculations because they were more understandable to me in less sophisticated form. I practiced for about four hours before I could write it on my own without looking up the calcs.

 

I have a question though, what does the statement

"Choose (Get(CalculationRepetitionNumber)- 1)"

Do in the calc and why? It appears to be required for the calc to work but the logic is escaping me.

Share this post


Link to post
Share on other sites
LaRetta

Hi SurferNate,

 

Choose() is a powerful function and one well worth mastering (and nope, I'm not there yet because every day I find new & exciting ways to use it). It is faster than most functions because it doesn't need to evaluate - it just does. That's my layman explanation; I'm sure Queue or others could explain it better. So:

 

"Choose (Get(CalculationRepetitionNumber)- 1)"

 

Choose() always must start with 0. So if you can force a calculation to 0, the first 'result' would go in the 0 spot. Since we are talking about repetitions (which always start with 1), adding the -1 to the Get(CalculationRepititionNumber) results in 0 which is just where we need to be to take advantage of Choose()!!

 

There are many combinations of functions that are naturals together ... Choose() works really well with Sign(), DayOfWeek() and so forth ... because it is easy to force them into a sequence starting with 0. In fact whenever possible, I'll take advantage of it - as every nanosecond counts in a solution. Oh, don't get me going! You've hit one of my hot spots for sure and I could head-trip this stuff til the cows come home. smile.gif

 

LaRetta

Share this post


Link to post
Share on other sites
stevehar

Wow, who knew! My original note question has really caused some huge insights. thanks for the discussion.

 

I've gotten the note field to work, given the high quality discussion so thanks.

 

Here is a new wrinkle:

 

In the case of a note field with a reverse chronological note with a line format like

-10/2/04 Steve Lorem ipsum dolor sit amet

 

I want to import action taken on many records to the note field and add a "line item" in the aappropriate point of the reverse chronological order.

 

So for example importing a .csv file that contains dated entries for records like -04/04/04 Steve Lorem ipsum dolor sit amet

 

The point is to update the note field for events that occurred outside the data base [were not hand entered by a user] and now need to be recorded in the note field. Getting it there is one concern, getting it there in reverse chronological order in the right place is another.

 

Make my eyebrows wrinkle.

Stevehar

Share this post


Link to post
Share on other sites
LaRetta

Hi Steve,

 

Hmmm, if you have different data coming into the field, then the audit purpose on that field is lost because it will no longer be tracking the changes made to one field but will instead be adding to it.

 

In this case, I suggest you treat it as a regular Notes table instead where each note is a different record. The date will be a different field and imported notes records can be 'inserted' in date order easily because they can be sorted. If you switch to a Notes table, both your Users and your outside sources can add to it but not be allowed to delete (unless you let them). This will still provide you with an audit log of activities as they won't be changing prior entries. smile.gif

 

LaRetta

Share this post


Link to post
Share on other sites
SurferNate

In terms of using a notes field to log a multitude of different actions (events so to speak), I went ahead and scripted each action through a button. to prevent a user from exiting a record or script I have a field comparison (field verification) set up so that once they initiate an action they only have two choices, continue through or revert completely. The button sets hidden field values as it progresses which are dependent on each other for validation. If the script is not completed the validation fails, the user is firmly scolded (for trying to weasel out of a commitment) and the record reverts. I used this method just today. :-) As long as the notes field cannot me modified by a user then it seems to perfectly register when a user clicked the button and what they did while the script was active.

 

I don't know how much this applies to your situation. I agree with LaRetta on a notes table being normally better. I'm having a difficult time deciding in a couple cases though whether the notes are critical outside of any given record. Therefore I am using both methods for different types of information.

 

The question I am asking myself to get the answer is: Can I imagine ever needing to search, relate and sort? Or is it just fixed linear history for a given record and has no relation to any other record?

Share this post


Link to post
Share on other sites
Bush

Actually, Harry, I was calling YOU a gal...

 

Frankly, I'm irritated that it's so hard to establish an AuditTrail in FM. All the solutions, even Ray's latest and sleekest, require retyping into the cal fields EVERY ONE OF YOUR FIELDS, a process which can get incredibly cumbersome in larger databases.

 

Further, there is no way of trapping login/logout for sure unless you disable closing windows with the X in the corner -- which can't be done without a $300 plug-in. Thank you, no. The NCI ain' giving me that much money to play with.

 

And it's just not feasible to buttonize EVERYTHING my users need to do.

 

Grrrr..

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use