Ошибка при делении

Обсуждение Stimulsoft Reports.JAVA
Ответить
montty
Сообщения: 23
Зарегистрирован: 02 апр 2014, 23:15

Ошибка при делении

Сообщение montty »

Добрый день!
У нас возникла ошибка при делении.

Код: Выделить всё

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
	at java.math.BigDecimal.divide(BigDecimal.java:1616)
	at com.stimulsoft.report.engine.parser.StiParser.op_Div(StiParser.java:1240)
	at com.stimulsoft.report.engine.parser.StiParser.executeAsm(StiParser.java:1592)
	at com.stimulsoft.report.engine.parser.StiParser.ParseTextValue(StiParser.java:2229)
	at com.stimulsoft.report.components.simplecomponents.StiSimpleText.InvokeGetValue(StiSimpleText.java:1392)
	at com.stimulsoft.report.engine.engineV2.builders.StiSimpleTextV2Builder.InternalRender(StiSimpleTextV2Builder.java:103)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.builders.StiComponentV2Builder.Render(StiComponentV2Builder.java:120)
	at com.stimulsoft.report.components.StiComponent.render(StiComponent.java:4069)
	at com.stimulsoft.report.engine.engineV2.builders.StiContainerV2Builder.InternalRender(StiContainerV2Builder.java:164)
	at com.stimulsoft.report.engine.engineV2.builders.StiBandV2Builder.InternalRender(StiBandV2Builder.java:105)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.StiEngine.InternalRenderBand(StiEngine.java:2235)
	at com.stimulsoft.report.engine.engineV2.StiEngine.RenderBand(StiEngine.java:2099)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1426)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1402)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderGroupFooters(StiDataBandV2Builder.java:814)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderMaster(StiDataBandV2Builder.java:1663)
	at com.stimulsoft.report.components.bands.StiDataBand.renderMaster(StiDataBand.java:1287)
	at com.stimulsoft.report.engine.engineV2.StiPageHelper.RenderPage(StiPageHelper.java:405)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.RenderReport(StiRenderProviderV2.java:865)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.Render(StiRenderProviderV2.java:247)
	at com.stimulsoft.report.engine.engineV2.builders.StiReportV2Builder.RenderSingleReport(StiReportV2Builder.java:64)
	at com.stimulsoft.report.StiReport.RenderReport(StiReport.java:1976)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1876)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1807)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1797)
	
Вызвана этой строкой в mrt

Код: Выделить всё

<Text>{IIF(Sum(Group.CountLesson)>0&Sum(Group.CountLessonHW)>0,Round(100*Sum(Group.CountLessonHW)/Sum(Group.CountLesson),2), "0.00")}%</Text>
              
при

Код: Выделить всё

        <Columns isList="true" count="10">
          <value>CountLesson,System.Nullable`1[System.Int32]</value>
          <value>CountLessonHW,System.Nullable`1[System.Int32]</value>
....
        </Columns>
Файлы mrt и xml прилагаю.

С уважением,
montty
HighAley
Сообщения: 1998
Зарегистрирован: 08 июн 2011, 11:36
Откуда: Stimulsoft Office

Re: Ошибка при делении

Сообщение HighAley »

Здравствуйте.

IIF() -- это фуекция, а для любой функции перед её выполнением производится вычисление ВСЕХ аргументов. Поэтому вы и получаете ошибку деления на нуль.
Попробуйте использовать тернарный оператор.

Спасибо.
montty
Сообщения: 23
Зарегистрирован: 02 апр 2014, 23:15

Re: Ошибка при делении

Сообщение montty »

Спасибо!
montty
Сообщения: 23
Зарегистрирован: 02 апр 2014, 23:15

Re: Ошибка при делении

Сообщение montty »

Вы знаете, всё равно у нас ошибка.
Заменили проблемные строки в mrt на

Код: Выделить всё

<Text>{Sum(Group.CountLesson)>0 ? Sum(Group.CountLessonHW)/Sum(Group.CountLesson) : 0}</Text>
и даже для тестирования на

Код: Выделить всё

<Text>{Sum(Group.CountLesson)>0 ? Sum(Group.CountLessonHW)/(Sum(Group.CountLesson)+1) : 0}</Text>
Ошибка.

Код: Выделить всё

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
	at java.math.BigDecimal.divide(BigDecimal.java:1616)
	at com.stimulsoft.report.engine.parser.StiParser.op_Div(StiParser.java:1240)
	at com.stimulsoft.report.engine.parser.StiParser.executeAsm(StiParser.java:1592)
	at com.stimulsoft.report.engine.parser.StiParser.ParseTextValue(StiParser.java:2229)
	at com.stimulsoft.report.components.simplecomponents.StiSimpleText.InvokeGetValue(StiSimpleText.java:1392)
	at com.stimulsoft.report.engine.engineV2.builders.StiSimpleTextV2Builder.InternalRender(StiSimpleTextV2Builder.java:103)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.builders.StiComponentV2Builder.Render(StiComponentV2Builder.java:120)
	at com.stimulsoft.report.components.StiComponent.render(StiComponent.java:4069)
	at com.stimulsoft.report.engine.engineV2.builders.StiContainerV2Builder.InternalRender(StiContainerV2Builder.java:164)
	at com.stimulsoft.report.engine.engineV2.builders.StiBandV2Builder.InternalRender(StiBandV2Builder.java:105)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.StiEngine.InternalRenderBand(StiEngine.java:2235)
	at com.stimulsoft.report.engine.engineV2.StiEngine.RenderBand(StiEngine.java:2099)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1426)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1402)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderGroupFooters(StiDataBandV2Builder.java:814)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderMaster(StiDataBandV2Builder.java:1663)
	at com.stimulsoft.report.components.bands.StiDataBand.renderMaster(StiDataBand.java:1287)
	at com.stimulsoft.report.engine.engineV2.StiPageHelper.RenderPage(StiPageHelper.java:405)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.RenderReport(StiRenderProviderV2.java:865)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.Render(StiRenderProviderV2.java:247)
	at com.stimulsoft.report.engine.engineV2.builders.StiReportV2Builder.RenderSingleReport(StiReportV2Builder.java:64)
	at com.stimulsoft.report.StiReport.RenderReport(StiReport.java:1976)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1876)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1807)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1797)
С уважением,
montty
Vadim
Сообщения: 107
Зарегистрирован: 04 апр 2013, 12:26

Re: Ошибка при делении

Сообщение Vadim »

Здравствуйте.
Пришлите пожалуйста проблемный отчет и данные.
montty писал(а):Вы знаете, всё равно у нас ошибка.
Заменили проблемные строки в mrt на

Код: Выделить всё

<Text>{Sum(Group.CountLesson)>0 ? Sum(Group.CountLessonHW)/Sum(Group.CountLesson) : 0}</Text>
и даже для тестирования на

Код: Выделить всё

<Text>{Sum(Group.CountLesson)>0 ? Sum(Group.CountLessonHW)/(Sum(Group.CountLesson)+1) : 0}</Text>
Ошибка.

Код: Выделить всё

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
	at java.math.BigDecimal.divide(BigDecimal.java:1616)
	at com.stimulsoft.report.engine.parser.StiParser.op_Div(StiParser.java:1240)
	at com.stimulsoft.report.engine.parser.StiParser.executeAsm(StiParser.java:1592)
	at com.stimulsoft.report.engine.parser.StiParser.ParseTextValue(StiParser.java:2229)
	at com.stimulsoft.report.components.simplecomponents.StiSimpleText.InvokeGetValue(StiSimpleText.java:1392)
	at com.stimulsoft.report.engine.engineV2.builders.StiSimpleTextV2Builder.InternalRender(StiSimpleTextV2Builder.java:103)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.builders.StiComponentV2Builder.Render(StiComponentV2Builder.java:120)
	at com.stimulsoft.report.components.StiComponent.render(StiComponent.java:4069)
	at com.stimulsoft.report.engine.engineV2.builders.StiContainerV2Builder.InternalRender(StiContainerV2Builder.java:164)
	at com.stimulsoft.report.engine.engineV2.builders.StiBandV2Builder.InternalRender(StiBandV2Builder.java:105)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.StiEngine.InternalRenderBand(StiEngine.java:2235)
	at com.stimulsoft.report.engine.engineV2.StiEngine.RenderBand(StiEngine.java:2099)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1426)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1402)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderGroupFooters(StiDataBandV2Builder.java:814)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderMaster(StiDataBandV2Builder.java:1663)
	at com.stimulsoft.report.components.bands.StiDataBand.renderMaster(StiDataBand.java:1287)
	at com.stimulsoft.report.engine.engineV2.StiPageHelper.RenderPage(StiPageHelper.java:405)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.RenderReport(StiRenderProviderV2.java:865)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.Render(StiRenderProviderV2.java:247)
	at com.stimulsoft.report.engine.engineV2.builders.StiReportV2Builder.RenderSingleReport(StiReportV2Builder.java:64)
	at com.stimulsoft.report.StiReport.RenderReport(StiReport.java:1976)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1876)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1807)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1797)
С уважением,
montty
montty
Сообщения: 23
Зарегистрирован: 02 апр 2014, 23:15

Re: Ошибка при делении

Сообщение montty »

Здравствуйте!
Файлы mrt и xml в архиве 7z.

С уважением,
montty
Vadim
Сообщения: 107
Зарегистрирован: 04 апр 2013, 12:26

Re: Ошибка при делении

Сообщение Vadim »

Здравствуйте.
Проблема решена и будет доступна в следующем пререлизе.
montty писал(а):Добрый день!
У нас возникла ошибка при делении.

Код: Выделить всё

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
	at java.math.BigDecimal.divide(BigDecimal.java:1616)
	at com.stimulsoft.report.engine.parser.StiParser.op_Div(StiParser.java:1240)
	at com.stimulsoft.report.engine.parser.StiParser.executeAsm(StiParser.java:1592)
	at com.stimulsoft.report.engine.parser.StiParser.ParseTextValue(StiParser.java:2229)
	at com.stimulsoft.report.components.simplecomponents.StiSimpleText.InvokeGetValue(StiSimpleText.java:1392)
	at com.stimulsoft.report.engine.engineV2.builders.StiSimpleTextV2Builder.InternalRender(StiSimpleTextV2Builder.java:103)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.builders.StiComponentV2Builder.Render(StiComponentV2Builder.java:120)
	at com.stimulsoft.report.components.StiComponent.render(StiComponent.java:4069)
	at com.stimulsoft.report.engine.engineV2.builders.StiContainerV2Builder.InternalRender(StiContainerV2Builder.java:164)
	at com.stimulsoft.report.engine.engineV2.builders.StiBandV2Builder.InternalRender(StiBandV2Builder.java:105)
	at com.stimulsoft.report.components.StiComponent.InternalRender(StiComponent.java:4064)
	at com.stimulsoft.report.engine.engineV2.StiEngine.InternalRenderBand(StiEngine.java:2235)
	at com.stimulsoft.report.engine.engineV2.StiEngine.RenderBand(StiEngine.java:2099)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1426)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderBand(StiDataBandV2Builder.java:1402)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderGroupFooters(StiDataBandV2Builder.java:814)
	at com.stimulsoft.report.engine.engineV2.builders.StiDataBandV2Builder.RenderMaster(StiDataBandV2Builder.java:1663)
	at com.stimulsoft.report.components.bands.StiDataBand.renderMaster(StiDataBand.java:1287)
	at com.stimulsoft.report.engine.engineV2.StiPageHelper.RenderPage(StiPageHelper.java:405)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.RenderReport(StiRenderProviderV2.java:865)
	at com.stimulsoft.report.engine.engineV2.StiRenderProviderV2.Render(StiRenderProviderV2.java:247)
	at com.stimulsoft.report.engine.engineV2.builders.StiReportV2Builder.RenderSingleReport(StiReportV2Builder.java:64)
	at com.stimulsoft.report.StiReport.RenderReport(StiReport.java:1976)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1876)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1807)
	at com.stimulsoft.report.StiReport.Render(StiReport.java:1797)
	
Вызвана этой строкой в mrt

Код: Выделить всё

<Text>{IIF(Sum(Group.CountLesson)>0&Sum(Group.CountLessonHW)>0,Round(100*Sum(Group.CountLessonHW)/Sum(Group.CountLesson),2), "0.00")}%</Text>
              
при

Код: Выделить всё

        <Columns isList="true" count="10">
          <value>CountLesson,System.Nullable`1[System.Int32]</value>
          <value>CountLessonHW,System.Nullable`1[System.Int32]</value>
....
        </Columns>
Файлы mrt и xml прилагаю.

С уважением,
montty
Ответить