Monday, August 07, 2006

Confused yet? 

Consider the plight of custom calculations on data items.

A regular data item (from the ffapplication object) has a very straight forward approach:
loff = foxfire.ffapplication
loItem = loff.DataItems.Items("Cars Mileage")

Now, loItem.Subtotal can be Y, N or O for Other. Y being an automatic summary value.
If it's "O", then it relies on loitem.SummaryCalculation which would be
0 - None
1 - Sum
2 - Count
3 - Average
4 - Min
5 - Max
etc

Let's say , it shoudl be average so it should be
loitem.Subtotal = "O"
loItem.SummaryCalculation = 3
loitem.SummaryLabel = "Average"

But now, a user decides to change this for a single report - so now we rely on loReq.dataitems.items(3) and they make it Minimum.

loreq = loff.requests.items("INVENTRY")
loItem = loreq.DataItems.Items(5) && Cars Mileage

Now, if the user is using the defaults, you would see:
loItem.Subtotal = "O"
loItem.SummaryCalculation = 3
loItem.CustomCalculation = 4

But what if the user doesn't want it to appear at all?
If we said loItem.CustomCalculation = 0, then Foxfire! might get confused because if they wanted it to be none, when we attempt to evaluate it using an EMPTY() call, it would return .T. and thus would go back to the SummaryCalculation. (example:

loItem.CustomCalculation = 0 && User wants it to be none
IF EMPTY(loItem.CustomCalculation) && This is TRUE
lnCalc = loitem.SummaryCalculation && this would be Avg
ELSE
lnCalc = loItem.CustomCalculation
ENDIF

This isn't what we wanted at all. So as a result, if you want to set an individual request's data item NOT to show nay values, set it to -1 like so:

loitem.CustomCalculation = -1

Now, our calculation when generating the report will work properly.

Hopefully we've helped resolve any confusion here.

Sunday, December 12, 2004

Storing and Retrieving User Settings with the new Object Model 

The Foxfire! object model lets you store and retrieve user options quickly and easily. You don't even need to
 
Let's say that loFF is the object pointer.
 
loFF.LogonUser("System","Admin") logs the system user account in.
 
Now, if you want to store some details about it, you can do
 
loff.SetUserSetting("FavoritePet","Dog")
 
Call GetUserSetting to retrieve the setting.
 
? loFF.GetUserSetting("FavoritePet")
 
This can be used for any custom settings as well.
 
Keep in mind that you have to call LogonUser first to ensure that you are pointing to the correct user account record.
 
Internally, the field LG_MISC is used to store all of the values.  Values are stored like:
FavoritePet:Dog
 
 
 
 

Saturday, October 23, 2004

New SendTo Values 

In earlier versions of the Object Model, valid values for oRequest.SendTo were only three: Screen, Printer or File.
 
Now with our new Preview control, you can send output to the following other options:
 
XLS - this is for formatted Excel output
DOC - Word format
RTF - Rich Text form
HTM - HTML
XML - Formatted XML output
PDF - direct output to PDF file
 
This will be used fairly heavily with the new Output engine which can generate these files quickly and easily.

Thursday, July 08, 2004

Expression Property for DataItem 

The DataItem object currently has ReportExpression and SortExpression properties. However, by and large, most developers will only ever deal with the ReportExpression. Being a property with a long title , typos are going to be everywhere so I have also added a property called Expression that simply returns and sets the ReportExpression property.

Sunday, November 30, 2003

New Object Model Blog 

Welcome to the Object Model Blog, a source for information about how to use Foxfire!'s new Object Model in either COM components or other formats.

This page is powered by Blogger. Isn't yours?