Is there a formula equivalent for LS functions like And, Or, Nor etc

Is there any way I can work in both LS and Command language with simple function like AND. In LS, I’m keeping track of actions by the user by setting a field equal to its value OR 1 or 2 or 4 etc and then following it by testing with AND. It’s easy to do, but then formula seems to be complicated.

Subject: is there a formula equivalent for LS functions like And, Or, Nor etc.

Just curious, when you say ‘keeping track of actions’, what do you mean and what is the objective?

Subject: RE: is there a formula equivalent for LS functions like And, Or, Nor etc.

Thank you all for your contributions - and for reminding me that I’ve been in computing for a Very Long Time :-). In fact, 30 years is an understatement!

To answer Doug - I need to keep track of user changes to separate fields. By using the OnChange code, I can tell whether user has done anything in the field, but then in Formula I need to know which fields have changed. I don’t want a one-to-one relationship which means keeping another field that flags the changed state. I want to keep all the changed flags in a single field.

In the end, Andre’s solution seems to be the best one in terms of easiest programming.

Subject: RE: is there a formula equivalent for LS functions like And, Or, Nor etc.

Yes, but I want a square wheel.

Actually, what I’m trying to do is different from the solutions in FAQ - it’s not a post-event audit trail. Before I save and exit from the current document, I want to know which fields the user changed, so that I can send only the relevant updates to an external service. Working in Outlook, you can do it by comparing the starting value of a field with the final value so it’s easy. I need to mirror this in Notes.

Subject: But what if…

So what happens if the user changes a field, the message goes out, and then the user bails without saving the changes? Fields aren’t ‘changed’ until the doc is saved.

The James Ray audit trail could serve as the foundation for ‘pre/post’ field value analysis - instead of writing an audit trail, send an email.

Round is better… :wink:

Subject: RE: But what if…

OK - let’s agree on oval as a compromise.

I don’t want to send the notification of change until the user hits “Save & Send”. That’s the whole point of accumulating flags whenever the user updates fields. As many as 15 fields are updatable. I only send notice of change(s) to the external service at that point (save button).

Subject: RE: But what if…

Why don’t you use LotusScript to read all the field values when the document is opened, and store them in a global variable (e.g. List As Variant with the item name as the key value)? Then in the Postsave event, compare the values just saved with the original values, and send your message at that time. Then, store the new values in the global in case the user keeps editing and saves again. That’s easy to code, and doesn’t send email unless the save succeeded.

Subject: RE: But what if…

Sounds like a great idea, Andre. It improves on the method of flagging, because that one fails to detect if the user changed a field and then changed it back.

Thanks.

Subject: But , but, but

Help!!!

I have declared a Class, and can access the list from all my libraries, but I can’t populate it on loading the document.

Sub New(nEventType As Integer, note As notesdocument, source As notesuidocument)

’ place holder for the derived class

generates errors, because source is empty.

Inside my own libraries, all the fields are empty.

If I populate from inside the document (using a button) then it fills the List, but then in executing Save & Send inside LS, I get errors that indicate the list is empty (not unpopulated - totally empty).

I’ve not worked with lists before - any help you can give is very appreciated.

Subject: RE: But what if…

And that’s exactly what James’ code does…nice, neat, plug and play - it’s one of the slickest ways I’ve seen to log information and James tells me that response to his original article was essentially zero except for me…

Subject: Appreciate it if you’ll post a link - I can’t find it easily.

Subject: RE: Appreciate it if you’ll post a link - I can’t find it easily.

FAQ of FAQs (when you post a new item, a link to all FAQs is at the top of the input form and the FAQ of FAQs is on that page).Search for ‘Ray’

Follow the link to Advisor

There’s a download link at the top. If you need the article (you shouldn’t), you’ll have to pay Advisor for that.

If you contact James, he may send you his updated version of the code. The old version works fine, the new version gets all sexy with classes and such. I do not have specific permission to share the code so I’d ask that you get in touch with Jimmy.

I don’t know that I have a current valid email for Jimmy but this search seems to point to some ways to get in touch:

http://www.google.com/search?hl=en&q="Jimmy+ray"+lotus+notes&aq=f&oq=&aqi=

Subject: RE: is there a formula equivalent for LS functions like And, Or, Nor etc.

Look in the FAQ of FAQs under ‘audit trail’ and you’ll find a number of great ideas. I LOVE the one created by James Ray - it plugs into any db, can handle front end or back end edits, and keeps track of who changed what when including field names. Don’t reinvent the wheel…

Subject: RE: is there a formula equivalent for LS functions like And, Or, Nor etc.

There are no equivalent operators, but I suppose you could use @Modulo to find out whether a particular bit is set (e.g. @Modulo(x; 64) >= 32), and + or - to assign it if it doesn’t already have the value you want. Not as straightforward, but that’s the story. With formulas, you might find a string of flag characters and @Contains easier to work with.

Subject: is there a formula equivalent for LS functions like And, Or, Nor etc.

The short answer is no. Command language does not have any functionality to handle bitwise logical operators. The & and | operators in command language only recognize True (not 0) and False (0).

Subject: From their same post where they added a bit more detail in the question…

I found this does what they want:

FIELD xx := 1:4:16;

@If(xx=16;“16 is there”;“16 isn’t there”)

Date

Topic

Author

3

is there a formula equivalent for LS functions like And, Or, Nor etc.

Watka Naidoo

yes there are equivalents (Created by Carl Tyler on 06/10/2009)









	sorry - does not seem to be what I'm looking for (Created by Watka Naidoo on 06/10/2009)









it would have been easier to help if you had given this much information the first time. (Created by Carl Tyler on 06/10/2009)

Subject: RE: From their same post where they added a bit more detail in the question…

But as I understand it, the actual field data is not 1:4:16, it’s 21, and he wants an easy way to check to see whether the “16” bit is set. Script can handle it, but Command language was never designed for fancy coding.

Frankly, you hardly ever see bit flags anymore, though it’s used in the Preferences field in notes.ini. In the middle ages (you know, 30 years ago or so) when storage space was expensive, it used to be quite common, so you could fit 16 yes/no flags into one 16-bit word.

Subject: Ah that makes more sense.