smusba
7th December 2014, 10:56
Dear,

I want to add Progress Bar to my report.

Below is the script.
How can I edit the above script?


declaration:

table twhwmd215 | Item Inventory by Warehouse
table twhwmd215 | Item Inventory by Warehouse
table ttcibd001 | Item Master
table ttcibd003 | Unit Master
table ttdsfl108 | Unit Master
table ttcmcs003
table ttcmcs015

extern domain tccwar cwar.f fixed
extern domain tccwar cwar.t fixed
extern domain tcitem item.f fixed
extern domain tcitem item.t fixed
extern domain tcamnt inv.str.unit
extern domain tccuni unit.unit

extern domain tccuni tcibd001.cdf_suni mb| This should be done for CDF
extern domain tcyesno tcibd001.cdf_nswi
extern domain tccuni tcibd001.cdf_nswu


|****************************** program section ********************************


|****************************** group section **********************************

group.1:
init.group:
get.screen.defaults()

|****************************** choice section ********************************

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif



|****************************** field section *********************************

field.cwar.f:
when.field.changes:
cwar.t = cwar.f

field.item.f:
when.field.changes:
item.t = item.f


|****************************** function section ******************************

functions:

function read.main.table()
{
select whwmd215.*
from whwmd215
where whwmd215._index1 inrange {:cwar.f, :item.f}
and {:cwar.t, :item.t}
order by whwmd215._index1
selectdo
if whwmd215.qhnd > 0.0 then
read.tcibd001()
if tcibd001.cdf_nswi = tcyesno.yes then
read.tdsfl108()
unit.unit = tcibd001.cdf_nswu
else
get.conv()
endif
wrh.dsca()

rprt_send()
endif
endselect
}

bdittmar
7th December 2014, 11:12
Hello,

search the forum with "progress" and you'll get a lot of hints.

Regards

From dev-guide :

Progress indicators sample program
#include <bic_dam>

function process.elements()
{
long i
long n
long ret

| Create a progress indicator
ret = create.progress.indicator( form.text$("tdsls1100.01" ),
PROGRESS.BAR + PROGRESS.STOP + PROGRESS.NOAUTODESTROY )
| We do not want any delay in this case
change.progress.delay(0)
| Display an initializing message
ret = change.progress.indicator( 0, form.text$("tdsls1100.02") )
|* Initializing...

| Now determine the number of elements to process
n = count.elements()

| Process the elements
for i = 1 to n
if change.progress.indicator( (i * 100) / n ) <> 0 then
abort.transaction()
break
endif
| Process element i
endfor

destroy.progress.indicator()
}

smusba
7th December 2014, 11:39
But how can I integrate this code in above report

bhushanchanda
8th December 2014, 13:24
Hi,

First you need to count the total number of records present in table whwmd215 for your given selection range and assign that to one of the variable e.g. total.no.of.rec

Then, in your current selection do this

select ...
selectdo
perc = perc + 1
change.progress.indicator((perc*100)/total.no.of.rec,"Processing")
endselect
destroy.progress.indicator()

Refer Thread (http://www.baanboard.com/baanboard/showthread.php?t=66837)