@Formula question

I am new to Lotus Notes designing so bare with me. I created an agent for a database but unfortunately lost it due to a crash and had no backup. One lesson learned there for sure.

I have created a simple database that is to track gift cards that are issued from the company. I want to create an agent that will run weekly to check the amount of unassigned gift cards and if it is below $300 it sends out one email, and if it is at $0 it sends out another.

I had it working originally but since reinstalling Notes I cannot get it to work again. I am thinking it is something simple that I am overlooking. Here is my formula:

amount := @If(@TextToNumber(@DbColumn(“”;“”;“(Amount Lookup)”;1)) != 0; @Sum(@TextToNumber(@DbColumn(“”;“”;“(Amount Lookup)”;1)));“”);

@If(amount = “0” ; “Out of Gift Cards”;

amount < 300; “Order More Gift Cards”;“”)

I am putting this in a newsletter so I don’t have to worry about the Mail Send function.

Any suggestions are appreciated. Thank you for taking the time to help me out in advance.

Subject: @Formula question

Greg,

I see a couple things that might cause a problem. I think for simplicity I would code it more like this:

tamount := @dbcolumn();

amount := @if(@iserror(tamount); 0; tamount = “”; 0; @sum(@texttonumber(tamount)));

Then you can check check @If(amount = 0; “Out of gift cards”; amount < 300; “Order more gift cards”; etc. )

Note that you need to compare against numbers or text, but not both (in yours you check amount = “0” or amount < 300).

regards,

raphael

Subject: RE: @Formula question

Sorry for the “0”, I know better but was playing around with different things. I must have forgotten to take that out. I will try your formula and see how that works. Thank you.

Subject: RE: @Formula question

I am putting this in a newsletter so I don’t have to worry about the Mail Send function.

I don’t understand what you mean here. I think you have to worry about the mail send function because there are some situations where you don’t want to send mail at all.

I do not like that your view column contains numbers expressed as text. Aren’t they number fields in the original documents? If not, what prevents people from entering non-numeric data in the fields?

Subject: RE: @Formula question

I am using radio buttons for two alloted amounts. They can only choose from two values. That is also why the numbers are a text value.