showstuff11
5th March 2015, 09:13
Can someone explain this error
i'm new in baan report...

rtcmcsksm0000042:
repgen '2tcB61Ca cpg mcsksm000004' -c 'tcB61Ca cpg ' -o "C:\Infor\CPFIBU1\tmp/tmp002848860" -T 0 -z -qe "C:\Infor\CPFIBU1\tmp/tmp002848861" -x "C:\Infor\CPFIBU1\tmp/tmp002848862" -L
bic "C:\Infor\CPFIBU1\tmp/tmp002848860" -z -u -o rtcmcsksm0000040 -f "C:\Infor\CPFIBU1\tmp/tmp002848859" -qe "C:\Infor\CPFIBU1\tmp/tmp002848861"
rtcmcsksm000004( 45): Warning: Comparison of a double type with a long type may yield unpredictable results
rtcmcsksm000004( 204): Error: Buffer 8 Kb too small for select statement. (While expanding macro 'r_spool_line_xml')
rtcmcsksm000004( 86): Error SQL: SQLState 42I00: Unexpected token '#' (error 302) (While expanding macro 'r_spool_line_xml')
rtcmcsksm000004( 204): Error: '=' not expected. (While expanding macro 'r_spool_line_xml')
rtcmcsksm000004( 323): Error: Unresolved reference to function 'r.xml.header.layout.2.row.1'.
rtcmcsksm000004( 324): Error: Unresolved reference to function 'r.xml.header.layout.2.row.2'.
rtcmcsksm000004( 670): Error: Unresolved reference to function 'r.xml.header.layout.1'.

1 warning reported.
6 ERRORS REPORTED.

tnx in advance

bhushanchanda
5th March 2015, 11:05
Hi,

Can you post your report script please? May be you need to use Dynamic SQL to resolve the buffer error.

Also, post some screenshots of the layouts. I guess you are using the layouts which are not defined.

showstuff11
6th March 2015, 02:33
Hi,

This is my script

i can't really explain all of this... because im just a learner at this point in time.

declaration:

table ttcmcs051,ttdsls400 | Number Groups
double val1
extern long month |month on form
long year, day , seriescount |Temp. variables
string combiness(999999)
domain tcqdhc average
domain tcqdhc usage
domain tcqdhc mo
domain tcqdhc mo2
double RemainingMonths
domain tcorno orno


Header.1:
before.layout:

select tcmcs051.dsca
from tcmcs051
where tcmcs051._index1 = {:tcmcs050.nrgr}
selectdo
endselect

detail.1:
before.layout:

num.to.date(date.num(),year, month, day)
mo = month
usage = tcmcs050.ffno-1
average =round( (usage / mo),0 ,2)
mo2 = 12 - mo + 1
val1 = tcmcs050.ffno

if val1 = 0 then

|RemainingMonths = round( ((99999 - 1) / average),0,2)
RemainingMonths = round( ((99999 - 1) / mo2),0,2)

else

|RemainingMonths = round( ((99999 - 1) / average),0,2)
RemainingMonths = round( ((99999 - 1) / mo2),0,2)

endif

seriescount = len(str$(tcmcs050.ffno))

if seriescount = 1 then
combiness = trim$(tcmcs050.seri) & "0000" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)

endif

if seriescount = 2 then
combiness = trim$(tcmcs050.seri) & "000" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)

endif

if seriescount = 3 then
combiness = trim$(tcmcs050.seri) & "00" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

if seriescount = 4 then
combiness = trim$(tcmcs050.seri) & "0" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

if seriescount = 5 then
combiness = trim$(tcmcs050.seri) & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

select tdsls400.odat
from tdsls400
where tdsls400.orno = :combiness


thanks in advance

mark_h
6th March 2015, 04:48
What I would do is comment out everything in your script. See if the report compiles. If it does compile then it is something in the script. Plus I would probably make "string combiness(999999)" something a little more realistic.

bhushanchanda
6th March 2015, 06:24
Hi,

Make the domain of combiness as tcorno.

You are comparing the domain with tdsls400.orno

Also,

I am seeing Header.1 instead of header.1 and a missing endselect at the end.

Corrected code -

declaration:

table ttcmcs051,ttdsls400 | Number Groups
double val1
extern long month |month on form
long year, day , seriescount |Temp. variables
|string combiness(999999)
domain tcorno combiness
domain tcqdhc average
domain tcqdhc usage
domain tcqdhc mo
domain tcqdhc mo2
double RemainingMonths
domain tcorno orno


header.1:
before.layout:

select tcmcs051.dsca
from tcmcs051
where tcmcs051._index1 = {:tcmcs050.nrgr}
selectdo
endselect

detail.1:
before.layout:

num.to.date(date.num(),year, month, day)
mo = month
usage = tcmcs050.ffno-1
average =round( (usage / mo),0 ,2)
mo2 = 12 - mo + 1
val1 = tcmcs050.ffno

if val1 = 0 then

|RemainingMonths = round( ((99999 - 1) / average),0,2)
RemainingMonths = round( ((99999 - 1) / mo2),0,2)

else

|RemainingMonths = round( ((99999 - 1) / average),0,2)
RemainingMonths = round( ((99999 - 1) / mo2),0,2)

endif

seriescount = len(str$(tcmcs050.ffno))

if seriescount = 1 then
combiness = trim$(tcmcs050.seri) & "0000" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)

endif

if seriescount = 2 then
combiness = trim$(tcmcs050.seri) & "000" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)

endif

if seriescount = 3 then
combiness = trim$(tcmcs050.seri) & "00" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

if seriescount = 4 then
combiness = trim$(tcmcs050.seri) & "0" & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

if seriescount = 5 then
combiness = trim$(tcmcs050.seri) & str$(tcmcs050.ffno-1)
|orno = trim$(combiness)
endif

select tdsls400.odat
from tdsls400
where tdsls400.orno = :combiness
selectdo
endselect

bhushanchanda
6th March 2015, 11:00
Also,

Error SQL: SQLState 42I00: Unexpected token '#' (error 302) (While expanding macro 'r_spool_line_xml')

Check if you have some corrupt data in your report layout like some special character.

I once had an issue with report. The reason was - there was a special character on my layout which XML doesn't support and which fails to print your report.

showstuff11
7th March 2015, 06:34
@Bhushan

thank you for correcting my coding and thank you for the information you've given me!

it'll help me a lot!!

have a nice day ahead!

showstuff11
7th March 2015, 11:29
@Bhushan

i have a short problem forgive me if i can't explain it deeply though.
here goes nothing.

TDU = total days from the very 1st day that the series is used up to the last.

(so i just need to find the tables where the series is used , this i get is hard so we just gonna use tdsls400 for example purposes only)

average = (totalusage /TDU) * 30

then i do this script:
num.to.date(date.num(),year, month, day)
mo = month
monthaverage = 30
totalusage = 41020 - 1

(assuming we are using the present month which is march and its # 3)
counter = mo

while counter > 0

if counter = 1 then | jan
totaldays = 31
endif

if counter = 2 then | feb
divis =4
leapyear = year \ 4
if leapyear = 0 then
totaldays = totaldays + 29
else
totaldays = totaldays + 28
endif
endif

if counter = 3 then | mar
totaldays = totaldays + 31
endif

if counter = 4 then | apr
totaldays = totaldays + 30
endif

if counter = 5 then | may
totaldays = totaldays + 31
endif

if counter = 6 then | jun
totaldays = totaldays + 30
endif

if counter = 7 then | jul
totaldays = totaldays + 31
endif

if counter = 8 then | aug
totaldays = totaldays + 31
endif

if counter = 9 then | sep
totaldays = totaldays + 30
endif

if counter = 10 then | oct
totaldays = totaldays + 31
endif

if counter = 11 then | nov
totaldays = totaldays + 30
endif
if counter = 12 then | dec
totaldays = totaldays + 31
endif

counter = counter - 1
endwhile

totaldays = totaldays + day

average = (totalusage / totaldays ) * monthaverage



the output of this script is:

Series Average totaldays
41019 32383.42 38

above is the wrong output, its supposed to be like this:

Series Average totaldays
41019 18931.85 65

i don't get why the variable totaldays is only 38 does the loop inside dont add ?

bdittmar
7th March 2015, 13:41
Hello,
why so complicate?

First:
Use CASE instead IF-then-else in your statement

Second:

All date is in LN (Calender)

Read and calculate the days for a period with data from table tcccp070.
(Periods !)
Start and Enddate for a year and month is stored in this table in UTC format.

Regards

showstuff11
9th March 2015, 04:49
@Bernd

i use ON-CASE instead of IF-THEN-ELSE

but i still get the same results

the variable totaldays still don't add up.

i hope theres a way to my problem

thanks and have a nice day!