Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
25%
500 - 800 GB
3%
800 - 1200 GB
11%
1200 - 1500 GB
11%
1500 - 2000 GB
14%
> 2000 GB
19%
Total votes: 36

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 16th January 2003, 16:00
ltannous's Avatar
ltannous ltannous is offline
Senior Member
 
Join Date: Sep 2002
Location: Canada
Posts: 280
ltannous is on a distinguished road
Baan: 4c4 - DB: Oracle - OS: UNIX
report script to display messages then exit

I have written in my report script the following:
Code:
 
before.layout:

select tiitm001.*
from tiitm001, tdsls045
where tiitm001.item = :tdsls045.item
selectdo
endselect

if tiitm001.hatc = " "
and tiitm001.item = tdsls045.item then 
     message("Warining HS code not found for %s",tdsls045.item)
endif 
exit()

What happens is that there are 2 items with no HS codes, the message displays one item then exits. How can I display all items then exit, without printing?
Reply With Quote
  #2  
Old 16th January 2003, 18:06
dbclark79's Avatar
dbclark79 dbclark79 is offline
Member
 
Join Date: Aug 2001
Location: Chicago, IL
Posts: 41
dbclark79 is on a distinguished road
Baan: Triton, BaanIV, BaanERP 5.0 - DB: Oracle, MS SQL, Informix - OS: Unix, NT
Couple of recommendations for your script:

1. You have "tdsls045" in your FROM clause but not in your WHERE clause. This may be confusing to the database driver.

2. Put the block of code containing your message in the SELECTDO section of your script (after SELECTDO and before ENDSELECT). This section of code will execute for every record selected in the SELECT statement.

3. Avoid using "exit()" in scripts. It is best to program the code such that it naturally completes execution of the script and empties the stack gracefully.

Good Luck!
-David
__________________
-David B. Clark
dbclark79@juno.com
Reply With Quote
  #3  
Old 16th January 2003, 23:08
ltannous's Avatar
ltannous ltannous is offline
Senior Member
 
Join Date: Sep 2002
Location: Canada
Posts: 280
ltannous is on a distinguished road
Baan: 4c4 - DB: Oracle - OS: UNIX
I have tried your suggestion, but

I have put the if statment within the select statement, however, the message appears, but the report is still printed. I need the report not to send if any item is missing the hs code.

Basically display the items that have no hs code, then exit instead of print.
Reply With Quote
  #4  
Old 17th January 2003, 02:51
evertsen's Avatar
evertsen evertsen is offline
Guru
 
Join Date: Jun 2002
Location: Canada
Posts: 308
evertsen is on a distinguished road
Baan: IVc4 - DB: Oracle - OS: HP-UX
I take it that the program source is not available? I don't think you can get away with not printing anything unless you put your code there.
__________________
Hope this helps,
Ev
Reply With Quote
  #5  
Old 17th January 2003, 05:31
ltannous's Avatar
ltannous ltannous is offline
Senior Member
 
Join Date: Sep 2002
Location: Canada
Posts: 280
ltannous is on a distinguished road
Baan: 4c4 - DB: Oracle - OS: UNIX
I do have the program code

I have the session code. I will try to enter it there.
Reply With Quote
  #6  
Old 17th January 2003, 06:32
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Just thought I would mention

Just thought I would mention that you could have used the after.receive.data event in the script - see this post. You could have read through the records and if that field was empty then you could have exited the report. BUT the best solution is to change the session script - a lot easier and cleaner.

Mark
Reply With Quote
  #7  
Old 17th January 2003, 20:10
ltannous's Avatar
ltannous ltannous is offline
Senior Member
 
Join Date: Sep 2002
Location: Canada
Posts: 280
ltannous is on a distinguished road
Baan: 4c4 - DB: Oracle - OS: UNIX
I have added it to the session script but

I have added the following to my sesison script, but the session does not exit properly.
.......................
Code:
selectdo
   select tiitm001*
   from tiitm001
   where tiitm001.item = :tdsls045.item
   selectdo
  
       if tiitm001.hatc ="" then 
            message("NO HS CODE")
            exit()
       endif
 
       rprt_send()
    endselect
endselect
}
Reply With Quote
  #8  
Old 17th January 2003, 20:52
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Session script..

Without knowing the rest of the script - you could try execute(end.program). That should take care of it - BUT be aware that if the rprt_send has executed this may leave a report hanging for the user. If this is the case then check your data before opening the report or sending anything to the report.

Mark
Reply With Quote
Sponsored Links
  #9  
Old 17th January 2003, 21:09
evertsen's Avatar
evertsen evertsen is offline
Guru
 
Join Date: Jun 2002
Location: Canada
Posts: 308
evertsen is on a distinguished road
Baan: IVc4 - DB: Oracle - OS: HP-UX
I never had any luck with exit() but always used end() instead (though they are supposed to behave the same).
__________________
Hope this helps,
Ev
Reply With Quote
  #10  
Old 17th January 2003, 22:44
lbencic's Avatar
lbencic lbencic is offline
Guru
 
Join Date: Dec 2001
Location: Lisle, IL, USA
Posts: 1,148
lbencic will become famous soon enough
Baan: 2.2d - LN - DB: most - OS: most
The exit() command is for 3GL scripts, end() and execute(end.program) should be used for 4GL.
Reply With Quote
  #11  
Old 18th January 2003, 00:17
dnnslbrwn's Avatar
dnnslbrwn dnnslbrwn is offline
Senior Member
 
Join Date: Jan 2003
Location: Toronto
Posts: 149
dnnslbrwn is on a distinguished road
Baan: IVc4 - DB: Informix - OS: Unix
pre-process the data

Don't know what this will do to performance, but why don't you validate that the data is clean before printing anything?

Code:
'


HC.problem = false

select tdsls045.item
from tdsls045
where [some rules that you choose]
and tiitm001._index1 = { tdsls045.item }
and tiitm001.hatc = ""
group by tdsls045.item
selectdo
    message("Item has no HC" & tdsls045.item)
     HC.problem = true
endselect

if HC.problem = false then
    [perform original select statement with send_rprt()]
endif
'

Cheers,

-Dennis

PS: Noticed that code gets prettied up... but only after a while. Is the moderator doing this for us? I tried adding the same strings around my code here.... but doesn't seem to work in the preview reply
Reply With Quote
  #12  
Old 18th January 2003, 00:22
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Smile Code cleanup

Sometimes the moderator does edit the post and put in the code tags. If you can edit your post then you can see where I put in code=baan and /code tags - do not forget these are enclosed in []'s. So you can do this your self sometimes I just like to cleanup the code.

Mark
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
print 2nd report from 1st report script cmandal Tools Development 6 15th October 2012 00:56
Variable value different in pgm. script & report script ? PacSun Tools Development 5 28th June 2006 20:09
Surpress the print of a report from within the report script Neal Matthews Tools Development 9 27th May 2004 18:57


All times are GMT +2. The time now is 17:07.


©2001-2018 - Baanboard.com - Baanforums.com