staugner
5th June 2003, 18:54
I have been asked to provide resin information (tibom010.sitm) on our shipping document. This document does not ordinarily use the bill of material. The resin I want to pick up is tibom010.pono = 10. The problem arrises for those items which have a sub-assembly and therefore no resin (and no .pono = 10). If I add the code to add tibom010.pono = 10, then I do not get a shipping document for those items with sub-assemblies.

I don't know how to write code that will select that field only when a .pono=10 exists and will still print the normal shipping document when no .pono=10 exists.

Thanks for any help

staugner

sujoy.sen
6th June 2003, 19:12
I would probably be able to give you a better answer if I saw an excerpt of your code: where and how you're doing the select on tibom010. Going off the information on your post I was wondering if you'd tried moving the default print commands into the selectempty section of your sql. The idea being, that in case the select for tibom010.pono = 10 comes up empty, the default print is executed. There may be a better way to do this, but it's hard to say without seeing your code. Hope this helps.

staugner
10th June 2003, 18:12
Hi Sujoy.sen, thank you for replying. I have never used selectempty, and don't understand how it is used. I have enclosed the document code.

Staugner

sujoy.sen
10th June 2003, 20:38
I am attaching a document with some changes to the code you'd posted. Changes are highlighted in blue. I've pulled tibom010 out of the outer loop select statement and inserted a new select statement for tibom010 just before the rprt_send(). I think this is a better way to go than using selectempty. Try this out and let me know if it works.

Thanks,
Sujoy.

sujoy.sen
10th June 2003, 20:42
Made an error in the document with the earlier post. Go with the one I'm attaching to this post. Thanks.

sujoy.sen
10th June 2003, 21:46
Sometimes it takes me a little longer to read someone else's code and understand what they are trying to do. This last attachment should best reflect what I think you're trying to do. Apologies again for the multiple posts.

staugner
11th June 2003, 18:49
I tried your solution, but it doesn't work for me. The system hangs and I have to kill it. With no results to look at, I don't know if it does what it is supposed to or not...

Thanks for trying.

sujoy.sen
11th June 2003, 19:06
Did you try running the code in debug to see where it was hanging? The individual code lines are very similar to what was in there earlier; just restructured to get you closer to the desired result.

staugner
11th June 2003, 19:12
My apologies Sujoy.sen, I did find the hang-up and it was my mis-typing, not your error.

It now gives me the results if there is a position 10 (resin used), but gives me the same resin if it is a part with no position 10 (no resin usage). I need to be able to print the report with accurate information under both conditions.

sujoy.sen
11th June 2003, 20:34
I am mis-typing all the time. I think I had a mixup for the Sales Order Lines table in the code between tdsls041 (Baan 4) and tdsls401 (Baan 5).

I assume that you're using the variables sitm.item, sitm.dsca and sitm.dsca in your report. I am not sure what your report looks like but if you would like to see blanks for these fields when an item does not exist in position 10 of the BOM, then you could either choose to initialize the variables just before the select statement on tibom010 or you could use the selectempty command within the sql to set the values of these variables to "" (attached document gives a better idea of what I mean by this).

Let me know if this works. Thanks.

staugner
11th June 2003, 22:31
You did it! I even managed to get it to print "End Item-None" if there is no resin. Thank you for all your trouble. I learned a lot here.

sujoy.sen
11th June 2003, 23:01
That's great! Glad I could help out.