Home > Default > Saved Data Selection Formula

Saved Data Selection Formula

November 30Hits:0
Advertisement
Hi...
I need some help in creating a Saved Data Selection formula. The data source is a SQL Server Stored Procedure which returns a number of fields including 16 'flag' fields which can contain either a 0 or a 1.
The client wants to select which 'flag' fields will be used to filter the report, interactively changing the selection(s).
Any number of fields could be selected, or just 1.
The parameter has values 1-16 along with a description. The description is what the user sees. The parameter is named 'Indicator'
I'm stumbling over the fact that the formula has to return a boolean.... I tried:
if not hasvalue({?Indicator}) or {?Indicator}=0  then 1=1;
    if hasvalue({?Indicator}) and {?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a}
    or hasvalue({?Indicator}) and {?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto}
    or hasvalue({?Indicator}) and {?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}
etc.....
    then 1 = 1
    else 1=0;
but I'm not certain how to construct the logic because at the end of all this, I need a THEN... which makes no sense...
I've created Saved Data Selects before, but there were specific tests that were applied, for examplde....
if hasvalue({?Parameter}) and {?Parameter}=1 then {field) in LastFullWeek
These were discrete user selections, not multiple selections, and the 'test' was concrete - this in there!
Any help you could provide would be welcome....

A: Saved Data Selection Formula

You don't actually have to have an If statement for this.  Your comparisons all evaluate to true or false anyways  So, what you can do is something like this:
(not hasvalue({?Indicator}) or {?Indicator}=0) or
({?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a} ) or
({?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto} ) or
({?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}) or
Notice where I've put the parentheses - these are very important for getting this to work correctly.
Note also that you don't have to include "hasvalue()" in all of the lines.  This is because of the way Boolean expressions are processed.  Because of the "or", Crystal will only process until it hits the first "true" result.  If {?Indicator} doesn't have a value, it will be caught with the "not hasvalue({?Indicator})" in the first line and none of the rest of the formula will be processed.
-Dell

Answers

You don't actually have to have an If statement for this.  Your comparisons all evaluate to true or false anyways  So, what you can do is something like this:
(not hasvalue({?Indicator}) or {?Indicator}=0) or
({?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a} ) or
({?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto} ) or
({?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}) or
Notice where I've put the parentheses - these are very important for getting this to work correctly.
Note also that you don't have to include "hasvalue()" in all of the lines.  This is because of the way Boolean expressions are processed.  Because of the "or", Crystal will only process until it hits the first "true" result.  If {?Indicator} doesn't have a value, it will be caught with the "not hasvalue({?Indicator})" in the first line and none of the rest of the formula will be processed.
-Dell

Read other 4 answers

Tags:

Related Articles

  • Saved Data Selection FormulaNovember 30

    Hi... I need some help in creating a Saved Data Selection formula. The data source is a SQL Server Stored Procedure which returns a number of fields including 16 'flag' fields which can contain either a 0 or a 1. The client wants to select which 'fla

  • Saving data selected in dropdown to databseNovember 30

    hi , please guide me how to save data selected from a dropdown to the database.Hi, You simply read the node bind to that dropdown, and collect it in variable or itab. then process as u want, read the node using get_attribute method. Yogesh NRead othe

  • Short dump while saving data after selecting '#' for variable in WIOctober 11

    Hello All, We have a selection variable in our webinterface on company code.After selecting '#',i am entering data and while saving it goes to dump. but client wants to have an error message displayed after saving data instead of runtime error (dump)

  • What if I implement data level security using Selection formula?November 30

    Hi All, I have a requirement to implement data level security for all the reports, the thing is, we donot have a front end application developed in java/.net or any other language, so we have only two options (as per me, if you think there are other

  • Selection formula not selecting by datesNovember 30

    I'm having an odd problem with my report. I'm trying to filter by the start date of a job. The DB I'm pulling from stores it as a string, YYYMMDD (e.g. today is 20090713). In most of my reports it works just fine, but in this one it seems that it's i

  • Using Date Range parameter in Subreport Selection FormulaNovember 30

    I have a subreport which includes this line in the selection formula: {Production.Date} = {?Pm-?DateRange} {?Pm-?DateRange} appears in the Subreport Links window, so it seems like it should work. The DateRange parameter is set by the user in the Main

  • Select formula works with one set of data but not another??November 30

    Post Author: rkckjk CA Forum: Formula I have the folloing Select formula:{Sheet1_.Assign Group History} = '{"COMPUTER OPERATIONS"}' and{Sheet1_.Resolved By Group} = "COMPUTER OPERATIONS"That I'm using to select records from an Excel sp

  • CRVS2010 Beta - Database login fails after setting select formulaNovember 30

    I am working through how to call the report and have it print programatically.  I was able to get it to print with the saved data, but as soon as i add a recordSelectionFormula to it, it fails saying the login is incorrect.  I have searched the forum

  • Report prints Saved Data not Refreshed DataOctober 11

    We were running VS 2005 and using the Basic CR 2005 Basic that comes with it.  We upgraded to use CR 2008 and found MANY issues after we went live in production that were apparent in the development.  This has caused a lot of stress with us as well a

  • How do I use a running total within a selection formula?October 11

    I am developing a report within Crystal Reports 2008.  My goal is to identify any accounts that have zero usage for at least six months in this current year.  I have account number, meter size, read date, usage, and a running total/subtotal by accoun

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.673 s.