BurghMan
22nd October 2004, 22:46
I am making my first attempt at AFS. I am attempting to automate the print order documents session (tisfc0408m000). The reason for this is that our company started printing all documents duplex to save money. When printing a range of production orders and when the route sheet is an odd number of pages, the start a new route sheet prints on the back of the paper. They want all new route sheets to start on a new sheet of paper.
I thought with AFS I could print each document individually to solve this problem.
I am posting my code. I copied the original forms to my session and added afs. to all form fields. I am getting a “No data within selection” message.
Also, I have AFS logging turned on, but I am not sure what to look for. I can post the afs log if that would help.
Thanks in advance,
|********************************************************
declaration:
#pragma used dll ottstpapihand
|*********************************************************
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
functions:
|******************************************************
function read.main.table()
{
afs.pdno = afs.pdno.f
while afs.pdno <= afs.pdno.t
afs.tisfc0408m000()
afs.pdno = afs.pdno + 1
endwhile
}
|*********************************************************
function afs.tisfc0408m000()
{
|*********************************************************
cprj.f = afs.cprj.f | ( I added afs. to all the fields on my form
cprj.t = afs.cprj.t
pdno.f = afs.pdno.f
pdno.t = afs.pdno.t
opno.f = afs.opno.f
opno.t = afs.opno.t
prdt.t = afs.prdt.t
|********************************************************
stpapi.enum.answer("tisfc0408m000", "order.sorted", tisfc.osrt.order)
stpapi.put.field("tisfc0408m000","cprj.f", afs.cprj.f)
stpapi.put.field("tisfc0408m000","cprj.t", afs.cprj.t)
stpapi.put.field("tisfc0408m000","pdno.f", str$(afs.pdno.f))
stpapi.put.field("tisfc0408m000","pdno.t", str$(afs.pdno.t))
stpapi.put.field("tisfc0408m000","opno.f", str$(afs.opno.f))
stpapi.put.field("tisfc0408m000","opno.t", str$(afs.opno.t))
stpapi.put.field("tisfc0408m000","prdt.t", str$(afs.prdt.t))
stpapi.enum.answer("tisfc0408m000", "document.sorted", tisfc.dsrt.doc.by.order)
stpapi.enum.answer("tisfc0408m000", "print.org", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "print.dupl", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "print.modi", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "covn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "roul.b", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "oprn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "matl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "matn.b", tcyesno.no)
stppapi.enum.answer("tisfc0408m000", "subn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "chel.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "sawl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "collect.sawl", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "cutl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "collect.cutl", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "recn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "insn.b", tcyesno.no)
|*********************************************************
error.msg.1 = ("Error Setting Report")
error.msg.2 = ("Error Printing Report")
**********************************************************
stpapi.set.report("tisfc0408m000", "rtisfc040802001","ASCII",error.msg.1)
stpapi.print.report("tisfc0408m000", error.msg.2)
stpapi.end.session("tisfc0408m000")
|*********************************************************
}
I thought with AFS I could print each document individually to solve this problem.
I am posting my code. I copied the original forms to my session and added afs. to all form fields. I am getting a “No data within selection” message.
Also, I have AFS logging turned on, but I am not sure what to look for. I can post the afs log if that would help.
Thanks in advance,
|********************************************************
declaration:
#pragma used dll ottstpapihand
|*********************************************************
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
functions:
|******************************************************
function read.main.table()
{
afs.pdno = afs.pdno.f
while afs.pdno <= afs.pdno.t
afs.tisfc0408m000()
afs.pdno = afs.pdno + 1
endwhile
}
|*********************************************************
function afs.tisfc0408m000()
{
|*********************************************************
cprj.f = afs.cprj.f | ( I added afs. to all the fields on my form
cprj.t = afs.cprj.t
pdno.f = afs.pdno.f
pdno.t = afs.pdno.t
opno.f = afs.opno.f
opno.t = afs.opno.t
prdt.t = afs.prdt.t
|********************************************************
stpapi.enum.answer("tisfc0408m000", "order.sorted", tisfc.osrt.order)
stpapi.put.field("tisfc0408m000","cprj.f", afs.cprj.f)
stpapi.put.field("tisfc0408m000","cprj.t", afs.cprj.t)
stpapi.put.field("tisfc0408m000","pdno.f", str$(afs.pdno.f))
stpapi.put.field("tisfc0408m000","pdno.t", str$(afs.pdno.t))
stpapi.put.field("tisfc0408m000","opno.f", str$(afs.opno.f))
stpapi.put.field("tisfc0408m000","opno.t", str$(afs.opno.t))
stpapi.put.field("tisfc0408m000","prdt.t", str$(afs.prdt.t))
stpapi.enum.answer("tisfc0408m000", "document.sorted", tisfc.dsrt.doc.by.order)
stpapi.enum.answer("tisfc0408m000", "print.org", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "print.dupl", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "print.modi", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "covn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "roul.b", tcyesno.yes)
stpapi.enum.answer("tisfc0408m000", "oprn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "matl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "matn.b", tcyesno.no)
stppapi.enum.answer("tisfc0408m000", "subn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "chel.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "sawl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "collect.sawl", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "cutl.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "collect.cutl", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "recn.b", tcyesno.no)
stpapi.enum.answer("tisfc0408m000", "insn.b", tcyesno.no)
|*********************************************************
error.msg.1 = ("Error Setting Report")
error.msg.2 = ("Error Printing Report")
**********************************************************
stpapi.set.report("tisfc0408m000", "rtisfc040802001","ASCII",error.msg.1)
stpapi.print.report("tisfc0408m000", error.msg.2)
stpapi.end.session("tisfc0408m000")
|*********************************************************
}