cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variable as Parameter

Former Member
0 Kudos

I have spend hours trying to add a shared date variable in a subreport as a parameter without success. This shared variable is a calculated formula. I have designed an Inventory Forecasting Report and the shared date variable is an out of stock date. This variable would be one of the last calculations because it has to pull the item information from the database with the Net Stock and Sales in order to calculate this Out of Stock Date.

I want the user to for example to put in for example 7/31/09 and and it will show all items equal or less than this date. I added another formula in the subreport and the main report to say that anything equal and before this date will say "Display" and anything else is "Suppress". I done this as a check to ensure that the parameter is calculated properly, which it is.

How do I show only items on the report that say "display"?

Is it best to create the parameter in the main report by passing the shared variable to the main report?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Did you try using record selection formula like this in the main report?

<={?Parameter}

Regards,

Raghavendra

Former Member
0 Kudos

I was playing around with this. I noticed that another person had a similar question and you told them to put the subreport in the report header. I tried that but the out of stock date stays the same for all the items. The out of stock date gets calculated after the net stock in the main report is pulled first from the database and then I want to filter the out of stock date after this happens.

Former Member
0 Kudos

If you want to pass any value from subreport to main report then put sub report in header so that it processes first and we can get it in main report. But if you want to pass the value from main report to sub report after calculating then you need to place the subreport after the section where it calculates.

Regards,

Raghavendra

Answers (1)

Answers (1)

Former Member
0 Kudos

Shared variables do not need to be passed as parameters. You may use the shared variable for instance in a conditional suppression formula to generate 'false' if the subject date is <= the shared variable, otherwise true.

e.g.

Shared dateVar CutOffDate;

If <table date> <= CutOffDate

Then false

else true

Former Member
0 Kudos

The record selection does not work. I think it is because it is not a field name.

I cannot seem to get the conditional suppression to work.

The shared formula in the subreport is

Shared DateVar ReturnDate;

if {@Monthly Forecast}=-1 then ReturnDate:= Date (2099,12 ,31 );

if {@Monthly Forecast} <> -1 then

(Shared dateTimeVar Shared_Out_of_Stock_Date :=CurrentDateTime + {@Monthly Forecast} ;

ReturnDate:=Date( CurrentDateTime + {@Monthly Forecast}));

ReturnDate

I passed the date to the main report. I done another StringVar to say display if it is less than or equal to the user input parameter it will say display. I done this in the subreport and the main report because I am not sure if I need to filter in the main or subreport.

Is there any way for a shared variable to behave in the same way as a record selection?

Can the shared variable get created in temporary memory so Item A would be assigned the shared date var so it would act like a record selection.

If this website does not have the ability to upload files I can send the link to the file on Rapidshare.com.

Seá