Trying to extract value from Status Log (all avo!)

For “Reporting” purpose, we require to extract some values from the Status_Log field.I need to, display them nicely in a view (I’m working on this), and, instead of current situation, whereby status_log is updated every time document is saved (even if Status is the same), it should now only update if the status actually changes. (This should make it easier to report on, looks nicer, and is a more accurate reflection of what the status_log is supposed to be doing)…

Example of small status log:

Generic Notes Developer 08/11/2006 Open: Draft

Generic Notes Developer 08/11/2006 Open: Draft

(taken from the field).

Field is NOT multivalued. Field is having the formula:

FIELD Status_Log := Status_Log;

FIELD Status:=Status;

@SetField(“Status_Log”;@Name([CN];@UserName) + " "+@Text(@Today) + " "+Status +@NewLine+Status_Log)

Then, I tried to add checking. I want it to look in the Status_Log field, pull out the last entered value, pull back only the status, and compare this with the value in the status field (maybe there is a better way !!??).

So - I tried using @Right:

FIELD Status_Log := Status_Log;

FIELD Status:=Status;

TempStatus:=@Right(Status_Log;"7 ");

@If(Status=TempStatus;@Return(“”);

@SetField(“Status_Log”;@Name([CN];@UserName) + " "+@Text(@Today) + " "+Status +@NewLine+Status_Log))

But it still always sets the status.

So I set up test fields, with all combinations of @Right, @Left, @RightBack, @LeftBack, @Middle, @MiddleBack,

but nothing I do seems to just pull back

Open: Draft

from the first line…

One question that it occours is, is there some way of JUST selecting the first line? Then I could search that for the string I want and go from there…I tried this one:

@Right(Status_Log;@Newline)

or also with

@Left(Status_Log;@Newline)

But it returns too much…Any ideas??

Subject: Trying to extract value from Status Log (all avo!)

You should be able to do this with a combination of the formulas you have tried but I’m about to go home so have not got time to play with the formula.

Another way to do it would be to add a hidden computed for display field on the form named e.g. OldStatus with a formula

@If(@IsDocBeingLoaded; Status; OldStatus)

and then in the code where you add to the log

@If(Status != OldStatus; ADD TO LOG; DO SOMETHING ELSE);

Subject: RE: Trying to extract value from Status Log (all avo!)

Thanks Matt,In the longer term, your way will be better…

Eventually, I seem to have worked a way…

It uses lots of extra fields:

TEST computed with value of Status_Log, IS multi-value,

TEST2 computed with value of @Left(TEST;@NewLine), Not Multi-value,

TEST4:yr:=@Text(@Year(@Today));

yrnum:=@Right(yr;1);

TempStatus:=@Right(TEST2;yrnum+" ");

@Trim(TempStatus), and then add to formula like:

@If(@GetField(“Status”)=@GetField(“TEST4”);Status_Log;

Giving a total of:

FIELD Status_Log := Status_Log;

FIELD Status:=Status;

FIELD Test2:=Test2;

FIELD Test4:=Test4;

@If(@GetField(“Status”)=@GetField(“TEST4”);Status_Log;

@SetField(“Status_Log”;@Name([CN];@UserName) + " "+@Text(@Today) + " "+Status +@NewLine+Status_Log))

Bit of a mess compared to your way!!!