Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Statement to Pull info dependent upon two columns 1

Status
Not open for further replies.
Feb 24, 2005
19
US
I am having trouble with the code to pull the following information. I need to pull data based on a Type and Modifier Column. I could pull all info for type 1,2,3,4,& 8 by using the select expert although I need to pull based on the modifier column that goes with those types. Example, I need to pull TYPE 4 MODIFIER 0, but I don't want TYPE 4 MODIFIER 1, and so on.

Someone please help me out with this.
 
Go to report->selection formula->RECORD. If the modifiers you want apply to all types that you want, then you would just create a formula like:

{table.type} in [1 to 4, 8] and
{table.modifier} = 0

If you are saying that you want certain modifiers to apply to certain types, then create a formula like:

(
{table.type} = 4 and
{table.modifier} = 0
) or
(
{table.type} in [1,5] and
{table.modifier} in [2,3]
) or
//etc.

-LB
 
I tried that code and it didn't seem to work. It was saying a string was required where I was placing the numbers for the table type.
 
You didn't identify the datatypes of your fields. If they are strings, enclose the numbers in quotation marks, as in:

(
{table.type} = "4" and
{table.modifier} = "0"
) or
(
{table.type} in ["1","5"] and
{table.modifier} in ["2","3"]
) or

//etc.

-LB
 
Thanks for getting back to me, I actually realized that was the problem I was having right after I had posted before...It was such a stupid mistake too....The only problem I'm having now is that this selection formula seems to be superceding the date range parameter that I had instituted in the report. With this code in there it pulls the full date range, but if I take the code out, it only pulls the user selected range like I want. Do you have any thoughts on that??

I appreciate the help
 
Please post your entire record selection formula.

-LB
 
Here you go. Thanks again for your help.

{PershingTrades.TradeDate} = {?Trade Date Range} and
{@Random Number} <= 0.10 and
not ({PershingTrades.Symbol} like "") and
(
{PershingTrades.SecType} = "1" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "2" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "2" and
{PershingTrades.SecMod} = "1"
)or
(
{PershingTrades.SecType} = "3" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "3" and
{PershingTrades.SecMod} = "1"
)or
(
{PershingTrades.SecType} = "4" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "9" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "8" and
{PershingTrades.SecMod} = "C,P,E,B,D,L,M,S,T"
)
 
In your very last clause, is this one value (if so, then it's okay as is) or do you mean each of these to be separate values? Then it should be:

{PershingTrades.SecType} = "8" and
{PershingTrades.SecMod} in ["C","P","E","B","D","L","M","S","T"]

You need to put the entire list of or statements within () so the formula doesn't read it as select the date by parameter OR (type = "8" and mod = "0"), etc. So it should look like:
{PershingTrades.TradeDate} = {?Trade Date Range} and
{@Random Number} <= 0.10 and
not ({PershingTrades.Symbol} like "") and
(
(
{PershingTrades.SecType} = "1" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "2" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "2" and
{PershingTrades.SecMod} = "1"
)or
(
{PershingTrades.SecType} = "3" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "3" and
{PershingTrades.SecMod} = "1"
)or
(
{PershingTrades.SecType} = "4" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "9" and
{PershingTrades.SecMod} = "0"
)or
(
{PershingTrades.SecType} = "8" and
{PershingTrades.SecMod} in ["C","P","E","B","D","L","M","S","T"]
)
)

...except I'm not sure what the last clause should be--only you know that.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top