Requested Tasks
Requested Tasks
Attached is a document that is coded based on various Requested Tasks. I would like to add another option, that if none of these specific requested tasks exist, "NONE REQUESTED" should appear. How would I go about that?
- Attachments
-
- my_NY_ReportMunicpalDeptSearches&StreetReport.doc
- (35 KiB) Downloaded 57 times
Re: Requested Tasks
You can use the <COUNT> and/or <VAR> command tokens in your document.
<COUNT>, as you might guess, counts the items in a collection - optionally using [...] style filters.
<VAR> uses local variables to store and retrieve data. You declare/assign the variable within the document, then refer to that value throughout the remainder of the document as you would a fieldcode. Currently, only scalar variables are supported, identified as such using a $ prefix to the variable name.
A few examples:
Count/display the properties in an order
Do something if there are more than 2 properties in an order
Count the properties in an order, and store the value in a variable called propcount:
Do something if there are more than 2 properties in an order, using the variable propcount
Display the number of properties in an order, using the variable propcount
In your case, you might take this sort of approach:
Let us know if you'd like more clarification.
<COUNT>, as you might guess, counts the items in a collection - optionally using [...] style filters.
<VAR> uses local variables to store and retrieve data. You declare/assign the variable within the document, then refer to that value throughout the remainder of the document as you would a fieldcode. Currently, only scalar variables are supported, identified as such using a $ prefix to the variable name.
A few examples:
Count/display the properties in an order
Code: Select all
<COUNT {{.Property}}>
Code: Select all
<IF ( <COUNT {{.Property}}> > 2 )>
Code: Select all
<VAR $propcount ( <COUNT {{.Property}}> )>
Code: Select all
<IF ( {{$propcount}} > 2 )>
Code: Select all
Number of properties: {{$propcount}}
Code: Select all
<VAR $a ( <COUNT {{.RequestedTask[{{.Task}} = "A"]}}> )>
<VAR $b ( <COUNT {{.RequestedTask[{{.Task}} = "B"]}}> )>
<VAR $c ( <COUNT {{.RequestedTask[{{.Task}} = "C"]}}> )>
...
<IF ( {{$a}} + {{$b}} + {{$c}} = 0 )>
NONE REQUESTED
</IF>
Re: Requested Tasks
Thank you very much. I attached the document that I put the Variable coding into. Please let me know which part is incorrect, as it is not working properly.
- Attachments
-
- my_NY_ReportMunicpalDeptSearches&StreetReport.doc
- (39 KiB) Downloaded 63 times
Re: Requested Tasks
Ah, I had a typo in my reply to you, which I've corrected. When referencing a variable, as opposed to declaring or assigning a value to it, you decorate it like a fieldcode. So it should have read:
Try that out and see if that takes care of your issue.
Tip - when debugging a document, it can be useful to just print the value of the variable or calculation into the document temporarily. Such as:
or
This sort of thing can help when trying to understand why the execution path of a document took a certain path (e.g. why an IF evaluated as true, etc.).
Code: Select all
<IF ( {{$a}} + {{$b}} + {{$c}} = 0 )>
NONE REQUESTED
</IF>
Tip - when debugging a document, it can be useful to just print the value of the variable or calculation into the document temporarily. Such as:
Code: Select all
{{$a}}
Code: Select all
<CALC ( {{$a}} + {{$b}} + {{$c}} )>
Re: Requested Tasks
Thank you very much. That worked!!
Re: Requested Tasks
Another thing, right now it's coded like this:
<VAR $a ( <COUNT {{.RequestedTask[{{.Task}} = "Certificate of Occupancy Search"]}}> )>
<VAR $b ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Buildings Search"]}}> )>
<VAR $c ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Fire Search"]}}> )>
<VAR $d ( <COUNT {{.RequestedTask[{{.Task}} = "Emergency Repair Lien Search"]}}> )>
<VAR $e ( <COUNT {{.RequestedTask[{{.Task}} = "Street Report"]}}> )>
<VAR $f ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Air Resources Search"]}}> )>
<VAR $g ( <COUNT {{.RequestedTask[{{.Task}} = "Oil Burner Permit Search"]}}> )>
<VAR $h ( <COUNT {{.RequestedTask[{{.Task}} = "Highway Department Search"]}}> )>
<VAR $i ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Health Search"]}}> )>
<VAR $j ( <COUNT {{.RequestedTask[{{.Task}} = "Landmark Search"]}}> )>
<IF ( {{$a}} + {{$b}} + {{$c}} + {{$d}} + {{$e}} + {{$f}} + {{$g}} + {{$h}} + {{$i}} + {{$j}} = 0 )>
NONE REQUESTED
</IF>
However, now I need to change that. I need it to pull "NONE REQUESTED" either if the task doesn't exist at all or if the task exists, but the status is Required. How would I do that?
<VAR $a ( <COUNT {{.RequestedTask[{{.Task}} = "Certificate of Occupancy Search"]}}> )>
<VAR $b ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Buildings Search"]}}> )>
<VAR $c ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Fire Search"]}}> )>
<VAR $d ( <COUNT {{.RequestedTask[{{.Task}} = "Emergency Repair Lien Search"]}}> )>
<VAR $e ( <COUNT {{.RequestedTask[{{.Task}} = "Street Report"]}}> )>
<VAR $f ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Air Resources Search"]}}> )>
<VAR $g ( <COUNT {{.RequestedTask[{{.Task}} = "Oil Burner Permit Search"]}}> )>
<VAR $h ( <COUNT {{.RequestedTask[{{.Task}} = "Highway Department Search"]}}> )>
<VAR $i ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Health Search"]}}> )>
<VAR $j ( <COUNT {{.RequestedTask[{{.Task}} = "Landmark Search"]}}> )>
<IF ( {{$a}} + {{$b}} + {{$c}} + {{$d}} + {{$e}} + {{$f}} + {{$g}} + {{$h}} + {{$i}} + {{$j}} = 0 )>
NONE REQUESTED
</IF>
However, now I need to change that. I need it to pull "NONE REQUESTED" either if the task doesn't exist at all or if the task exists, but the status is Required. How would I do that?
Re: Requested Tasks
Effectively, you want to know if there are any tasks of the targeted task types where the status is not required. If there are, then you don't want to display your custom message.
Each variable will be set to 0 if (a) there are no tasks of the targeted task type, or (b) there are tasks of the targeted task type but they all have a status of Required.
Code: Select all
<VAR $a ( <COUNT {{.RequestedTask[{{.Task}} = "Certificate of Occupancy Search" and {{.Status}} <> "Required"}}]> )>
<VAR $b ( <COUNT {{.RequestedTask[{{.Task}} = "Department of Buildings Search" and {{.Status}} <> "Required"}}]> )>
...
<IF ( {{$a}} + {{$b}} + {{$c}} + {{$d}} + {{$e}} + {{$f}} + {{$g}} + {{$h}} + {{$i}} + {{$j}} = 0 )>
NONE REQUESTED
</IF>