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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop variable assignment 1

Status
Not open for further replies.

okon3

Technical User
Jan 4, 2009
25
US
Sorry I searched the groups and could not find an answer to this.
I have a subreport that holds a function that assignes a shared variable.
Is there a way to stop this variable from being processed?

I've tried suppressing the section, the report as well as the item, but the variable is still assigned. It is a conditional variable that I only want assigned if the report contains information.
It seems the variable is populated just by the subreport being called even if there are no results returned.
The function sets a=1 are present.
Thanks,
Tom
 
Please show the content of the formulas used and explain their locations.

-LB
 
LB, Actually I had abandoned that idea and tried to create this in a single report as the subport added 4 minutes to the processing time.
But,sorry to bug you again this is the same report I'm working on. For people filling out a form every six months, where they have have multiple times they have filled out the form but if the most recent is < 6months they don't have to do it again.
The main issue is that there are two dates for most of the documents(often the same date but different times)= two rows

Two tables appointment and document.

I group by appt date, then appt time then alphabetically, then by filtered (HDID field) with ID number(4095) then document date(Date) of the document with a sort of most recent document first.

I've filtered the details with a supression to not repeat the patient on patient ID as to eliminate all records on the same day, but I still got the older records.

So I created a subreport links with a row specific field (DOCID) for the most recent record. And the subreport evaluates if the date is within the last six monts.

I've tried the following
shared numberVar svar;
svar :=1;
Wait
I added my supression statment to the front of this and it seems to have worked:
shared numberVar svar;
if {DOC.DATE} > currentdate - 180 then svar :=0 else svar :=1
(I could have sworn I tried this) sorry


I also used the {DOC.DATE} > currentdate - 180 on the subreport and its details to supress them if they didn't fit the criteria, which works great.

What would be nice is to throw it into one report, it seems adding this subreport has extended the processing time from < 5 seconds to about 4 minutes.

Somehow with a left join to capture the people that have never filled out the form and use a Maximum ({DOC.DATE},{DOC.HDID}) > currentdate - 180 within the HDID group where HDID=4095 yet include the ones that are null or never created because they haven't filled out the form. THat seems to be my hangup. Returning only the oldest one to compare that date with and also include the null ones. kind of a if (hdid=4095 and {date} > 180 days old) or not ifnull({date}) then supress form.
Thanks and sorry for the book.




 
It sounds like you need the report to display by appointment date and time, and that therefore people with multiple datetimes could appear more than once. I think you SHOULD use a subreport, that is linked to the patient ID only and which only uses the document table. Then you can write a subreport record selection formula like this:

(
isnull({doc.hdid}) or
{doc.hdid} = 4095
) and
{doc.patientID} = {?pm-appt.patientID}

Then in the subreport, insert a group on patientID and then create a shared variable formula and place it in the detail section:

whileprintingrecords;
shared datetimevar docdt;
if isnull({doc.date}) then
docdt := date(0,0,0,0,0,0) else
docdt := maximum({doc.date},{doc.patientID});

Then in the main report, place the subreport in a detail_a section, with the appointment info in the detail_b section. In the section expert, suppress detail_b conditionally using a formula like this:

whileprintingrecords;
shared datetimevar docdt;
docdt > currentdate-180

You can suppress all sections within the subreport, format the subreport to "suppress blank subreport" and in the section expert, format detail_a to "suppress blank section."

You should also add a suppressed detail_c section where you add a reset formula:

whileprintingrecords;
shared datetimevar docdt := datetime(0,0,0,0,0,0);

Another approach which might be faster would be to use a command as your datasource for the report. If you are interested in pursuing this, let me know.

-LB
 
LB,
Thanks for the reply, I don't know how you do it. I confuse myself trying to describe what I am trying to do.

I don't need it to diplay appointments by dates and times, That was the only way I could find to order and sort them. It it really more of a selection list, and so they would print out in the order they are scheduled, so the people running this would not have to search thru a stack of paper. If that is understood, I apologize.

I believe I've tried this as you describe. although I have one error the docdt := date(0,0,0,0,0,0) return a "Too many arguments have been given to this function" in the:
whileprintingrecords;
shared datetimevar docdt;
if isnull({obs.date}) then
docdt := date(0,0,0,0,0,0) else
docdt := maximum({obs.date},{obs.patientID});

and the last three zeros are highlighted, if I remove them it accepts the formula. docdt := date(0,0,0)

I don't think the subreport gathers any data, if I add a text box to anyplace in the subreport it does not display in the main report. Currently I have nothing set to suppress, other than detail b in the main report

{Main}
groups
appt.time
appt.id

Details:
a: subreport
b: form to be printed, suppressed with the > 180 days
c: reset variable in subreport

subreport:
selection:
(isnull({obs.hdid}) or
{obs.hdid} = 4095) and {OBS.PID} = {?Pm-APPT.ID}

group
obs.pid

details
variable:
whileprintingrecords;
shared datetimevar docdt;
if isnull({obs.obsdate}) then
docdt := date(0,0,0) else
docdt := maximum({obs.obsdate},{obs.PID});

I hope I didn't miss or exclude anything, but the subreort always comes back blank, even with generic text box entries placed in any section of it.

Sorry to bug you and thanks for any suggestions you may have.
Tom

 
Holy Cow, I must have done something wrong before although I'm not sure what. I scrapped that report and started fresh.

I still get multiple listings on people that hae filled the form out multiple times. Don't do anything that may be OK if I can supress them all. I need to test the results with the supress on > 180 days and it may work.
Just wanted to post an update in case someone was looking at my last post.

Thanks,
 
LB-
Thanks a ton for your help. I have now see that I can tweak this more but you have shown me some options.

I don't know how you do it. I've seen you post to a ton of requests here all with great information, when only given pieces to work with. I confused myself describing this yet you picked it apart in only a few minutes. I really didn't think much help could be offered without knowing the specific database, or should I say the specifics of the DB. You should write a book :)
Thanks again, I really appreciate it and will continue lurking in the forum.
Thanks
 
Actually, that should have been:

docdt := datetime(0,0,0,0,0,0);

Is {APPT.ID} a reference to a particular patient? If not, your subreport linking is incorrect. The link should be linking a patient field in the appt table to the patient field in the obs table.

I don't think you should be getting multiple records for the same person though. Can you show a sample of the results you are getting, but also show the value of docdt when placed in detail_b?

-LB
 
Maybe I mispoke. I get multiple values in the subreport as below. The first date are the dates the document were sing and the second is docdt:
5/7/2008 5/12/2008
5/7/2008 5/12/2008
5/12/2008 5/12/2008

I was expecting only one value in the details section, but you are correct only the 5/12/2008 date is returned to the main report.
Sorry, I meant the subreport contained many fields, but it only returned the most recent to the form.
Two things about this formula:
if isnull({obs.obsdate}) then
docdt := date(0,0,0,0,0); else
docdt := maximum({obs.obsdate},{obs.PID});

1)I was confusing this with the record selection and expecting either a null/0,0,0 value or the max date in the subreport. My mistake

2)when I change the docdt:=date(0,0,0) to docdt := date(0,0,0,0,0); I get "The remaining text does not appear to be part of the formula" and everything after the ; is highlighted.

Thanks again, now I need to add a third clause if appt type =xxx then print regardless of other paramaters, but I'll try that on my own here over the next couple of days.
Thanks again for your help!
Tom
 
You have left out time and there should be six zeros, not five. Should be:

datetime(0,0,0,0,0,0)

All sections within the subreport should be suppressed, so that the multiple dates won't appear anyway.

-LB
 
Sorry, right the only thing I initially noticed was the addition of the ; at the end.

Forgive the question but does datetime vs date really matter in THIS circumstance? If date only is the information I am looking for?
Thanks again
 
Since your field is a datetime, I used a datetimevar, NOT a datevar--that was why the formula failed earlier when I forgot to use datetime() and didn't add enough zeros. I used that so that I didn't have to first convert the datetime to a date before using the maximum function.

-LB
 
Gotcha,
Sorry to step back but just to clarify the suppression box and the x-2 options

click the box= supress item
x-2=conditionally suppress item if condition true ie. 1=1(suppress area)

Click box and conditional statement=supress if condition false: ie. 1=2 in the formula field with the suppress box checked then I would think the box would display? as 1<>2

I'm working on a appt type now where as I want all appts of a particular type to show regaurdless of the date the form was filled out.
I can do a conditional {APPT.APPTTYPE}=1421074178550600.00
and the section is suppressed if that is the appt type. However if I check the supress box then add the same formula. I would expect all others to be supressed but the ones that equal 1421074178550600.00 t be displayed.
Is this correct?

Thanks again,
Tom
 
No. A conditional formula overrides the value of the box EXCEPT in one case--when the conditional formula does not execute--only then does the condition of the box apply. In most cases, it makes sense NOT to check the box when using a conditional suppression formula.

If you need to suppress the entire section, do not use the formula area at all. Just check the box.

If you were trying only to display the particular value you would use a formula like this:

{APPT.APPTTYPE} <> 1421074178550600.00

-LB
 
OK sorry I am having a hard time with this.
If the suppress box was checked and a condition was placed
{field}=2

The area would be suppressed unless the field=null, or some other reason that kept the formula from being processed?
In this case I would normally assume that if it is null then it obviously does not =2. But I am finding out crystal is it's own animal :)
But it is not as I thought where it would suppress all EXCEPT where {field}=2.
Am I close?
Thanks again,
Tom
 
Sorry again, your problem child.
I am trying to insert a blank page between the booklists(group) and I am unsuccessful
report header
page header
groups
booklist
appt time
appt id

I have everything suppressed which maybe part of the issue, but when I click the new page before in the section expert for the booklist group I get no blank page or when I click the new page after in the booklist footer I get no blank page.
Do I need to unsuppress and certain sections for this to happen?
If I just unsupress group footer for booklist then I do get a blank page at the end and the same with group header section unsupressed a page at the very beginning.
But nothing between the groups?
Thanks and sorry to be your problem child
 
You have to specifically address nulls--they are not considered among the alternatives to a specific value. If you don't address them specifically, the field is treated as if it is non-null. So if you wanted to suppress a section when a field is null or = 2, you would use a formula like this:

isnull({table.field}) or
{table.field} = 2

Please start a new thread for your new topic.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top