Method Community

 

Report Designer - Summary with Conditions

Last post 08-18-2015 7:22 AM by ITfromValor. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-04-2015 11:08 AM

    Report Designer - Summary with Conditions

    Hello! I am trying to create a summary for a group, but calculate it only for items that fit into specific category. I cannot figure out a way how to make a conditional summary, does anyone have experience with that? I would really appreciate your help! Thanks!

  • 08-06-2015 8:31 AM In reply to

    Re: Report Designer - Summary with Conditions

    I've done something similar for an estimate. We only wanted certian categories of items on some printouts. I modified the EstimateLineDetail section (click the EstimateLineDetail bar and then click the arrow box) and was able to create a filter string ([Item] Like 'Electrical%'). This would then filter out any lines where the item didn't start with Electrical. My summary was added as a normal summary. This only works on the Detail band from what I have seen. There's not a way to set a filter on groups that I am aware of.

  • 08-06-2015 10:14 AM In reply to

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Re: Report Designer - Summary with Conditions

    This can be done using scripts. It can a bit daunting if you haven't used scripts before and it can try your patience making sure everything is setup correctly, but it can be done.

    The idea is that on form load you declare global variables for the different categories. Then in the detail, on the category field or the number field (that you are trying to sum) you add a script that contains the conditions such IF category = "cat1" THEN cat1sum = cat1sum + numberField. After adding the conditions for all the categories you would add a label for each category in the footer that has a script that enters the sum in to the label.

    Hope that helps!


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


  • 08-07-2015 2:47 PM In reply to

    Re: Report Designer - Summary with Conditions

    Thank you both! I think that I know what to do now and I will see if it works! Thanks again.

  • 08-18-2015 7:22 AM In reply to

    Re: Report Designer - Summary with Conditions

    EDIT: figured it outIf Not(String.IsNullOrEmpty(item))

    Hello! I am still improving this report with customized summaries and after I followed Matt's instructions, it works great. Until the input is empty - the picked dates generate no data and the report should be empty.Then I get an error message, because I still try to calculate the sum although I have no data. I would like to add a check for no input before the whole calculation. And I cannot really figure out how to phrase it. Because it is not necesarrily an empty row, or is it? Thanks!

Page 1 of 1 (5 items)