How do I implement a checkbox on a report during runtime?
I am developing a parcel report where I plan to implement checkboxes. For example, if the subject parcel is within a flood plain the 'floodplain' checkbox control would be checked at runtime. Since ArcGIS does not have a boolean datatype, I'm confused about how to implement this checkbox functionality. Right now, the data driving the report is in a file geodatabase with a string field containing "Yes" or "No" values for the floodplain example I cited. Do I have to script the checkbox behavior (being checked) on the report at runtime if the value is "Yes"? Or am I making this more complicated than it needs to be? Any help would be appreciated. If it matters, I am running AGS 10.3 map services, Essentials 4.6.1 and GVH 2.7.
0
-
I don't know about needing scripting, but you can use expressions in the properties for most of those controls. I would try throwing an inline "If" in there and see what happens. 0 -
Hi Erick,
You would then need to add a “calculated field” with a formula that points to the dataField that you would like to use. As long that formula always has a Boolean result you’ll be fine.
In your report template, in “controls” section there is check box object that can be placed in the “detail” area of the report. In dataField property of the checkbox place the name of your “calculated field” and it should work.
For example I have a “STATUS” field that is a string. If the string contains a value I want checkbox ticked otherwise checkbox should be not ticked. Calculated field contains formula below
((STATUS + " ").ToString().Trim() != "" ? True : False)
I hope this helps0 -
Thanks, Zach and Francesca. I was intially a little confused about how to implement your suggestions but I figured it out.To summarize, I created a calculated field for each check box control on the report by right-clicking the Fields...Calculated control on the upper right of the UI and choosing Add. I defined the calculated field type as a Boolean by choosing Boolean from the Field Type drop-down list. After naming the new calculated field (cfFloodplain in my example) I used the formula that Francesa suggested for the calculated field's Formula property (in my example I used ((Parcels.Floodplain + " ").ToString().Trim() != "No" ? True : False). This sets the boolean value of the calculated field based on the feature's data value (in my example all features have a value 'Yes' or 'No') . I then set the Datafield property of the checkbox control to the name of the calculated field on the report (cfFloodplain). That worked great! Thanks again. 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
3 kommentarer