Hi all,
I have an audit trail which I need the date out of to go inside a column view.
Audit trail looks like this:
Chris Earnshaw 07/04/2009 Created Document
I want to count from 2 spaces as every persons name is a different length, then take a @Left to grab the date.
Is this possible?
Subject: String Handling with spaces
using @Word(yourLogTrail;" ";3) should do it.
Renaud
Subject: RE: String Handling with spaces
If you are using LotusScript then the split function will do a similar thing : give you an array of your string split at the spaces if you specify space as the delimiter
Date will then be at array(2)
Subject: String Handling with spaces
The @Word function splits your string into words with the separator specified, then you just transform each word into time and back in string, if it is not a date, it will produce an empty string, if not you have your date, just print it.
This might not be elegant, but does the job, and will handle different length of names…
String := “Chris Armando Earnshaw 07/04/2009 Created Document”;
Val1 := @Text(@TextToTime(@Word( String ; " " ; 1 )));
Val2 := @Text(@TextToTime(@Word( String ; " " ; 2 )));
Val3 := @Text(@TextToTime(@Word( String ; " " ; 3 )));
Val4 := @Text(@TextToTime(@Word( String ; " " ; 4 )));
Val5 := @Text(@TextToTime(@Word( String ; " " ; 5 )));
Val6 := @Text(@TextToTime(@Word( String ; " " ; 6 )));
Val7 := @Text(@TextToTime(@Word( String ; " " ; 7 )));
Val8 := @Text(@TextToTime(@Word( String ; " " ; 8 )));
@If( Val1 != “”; Val1;
Val2 != ""; Val2;
Val3 != ""; Val3;
Val4 != ""; Val4;
Val5 != ""; Val5;
Val6 != ""; Val6;
Val7 != ""; Val7;
Val8 != ""; Val8;
"");
Subject: String Handling with spaces
Can you be sure that a name always consists of one first name and one last name only?Eg. Lord Witherspoon III, Herbert George Wells
I would use the “/” as the seperator in your case (I cannot think of that many names containing a slash)
day:=@right(@left(trail;“/”);2);
monthYear:=@left(@right(trail;“/”);" ");
day +“/” +monthyear
Subject: RE: String Handling with spaces
I had thought of that, but what is the date format is with “-” instead of “/”, or if the format is dd/mm/yyyy instead of mm/dd/yyy…
Subject: RE: String Handling with spaces
Yes I thought of that date issue also, but since his given example was with slashes I thought he could use it. Ofcourse datefields are always an issue but in most cases within a company there is a kind of standard (or at least there should be ;-))
I think the best case in his situation -if datenotation is an issue- is if he uses a seperator between the date and the status
Chris Earnshaw 07/04/2009 - Created Document
Now you can always get the date in a save way using @right(@leftback(trial;" - ");10)
In general I think it is a good thing to seperate different values within one string with something other than spaces.
I don’t think the difference in dd/mm/yyyy or mm/dd/yyyy is an issue here, 'cause as far as I know there is no way you can say whether 04/07 is July or April once it is saved in a string format like he uses it.
Subject: RE: String Handling with spaces
Good point…