jojovalenton
24th October 2019, 14:47
hi,

need some help on how to call group report 2 in afs. pls find below scripts:

string error.msg(100)
|*AFS script...
stpapi.put.field("tfacp1430m000","suno.f","")
stpapi.put.field("tfacp1430m000","suno.t","ZZZZZZZZZ")
stpapi.put.field("tfacp1430m000","fico.f","700")
stpapi.put.field("tfacp1430m000","fico.t","720")
stpapi.put.field("tfacp1430m000","comp.f","700")
stpapi.put.field("tfacp1430m000","comp.t","700")
stpapi.put.field("tfacp1430m000","otyp.f",str$(etol(tfacp.otyp.purchase)))
stpapi.put.field("tfacp1430m000","otyp.t",str$(etol(tfacp.otyp.purchase)))
stpapi.put.field("tfacp1430m000","orno.f",imp.orno1)
stpapi.put.field("tfacp1430m000","orno.t",imp.orno2)
stpapi.put.field("tfacp1430m000","cofc.f","")
stpapi.put.field("tfacp1430m000","cofc.t","ZZZZZZ")
stpapi.put.field("tfacp1430m000","date.f","0")
stpapi.put.field("tfacp1430m000","date.t",str$(utc.num()))
stpapi.put.field("tfacp1430m000","home.ccur","PHP")
stpapi.enum.answer("tfacp1430m000","print.invoices",tcyesno.no)
stpapi.enum.answer("tfacp1430m000","print.zero",tcyesno.no)
stpapi.enum.answer("tfacp1430m000","print.to.match",tcyesno.yes)
stpapi.set.report("tfacp1430m000","rtfacp143011000","N",error.msg)
stpapi.set.report("tfacp1430m000","rtfacp143012000","N",error.msg)
stpapi.set.report("tfacp1430m000","rtfacp143022000","N",error.msg)
stpapi.set.report("tfacp1430m000","rtfacp143041000","N",error.msg)
stpapi.set.report("tfacp1430m000","rtfacp143021000","N",error.msg)
stpapi.print.report("tfacp1430m000", error.msg)
stpapi.end.session("tfacp1430m000")

regards,
jojo

mark_h
24th October 2019, 15:21
I can see several things wrong with that code. I would skip this statement - stpapi.put.field("tfacp1430m000","date.f","0"). Then I think these should be stpapi.put fields - these are on the form in my 4c4 session.

stpapi.enum.answer("tfacp1430m000","print.invoices",tcyesno.no)
stpapi.enum.answer("tfacp1430m000","print.zero",tcyesno.no)
stpapi.enum.answer("tfacp1430m000","print.to.match",tcyesno.yes)

And last but not least - only use one stpapi.set.report for the report you want to get.

I typically use the stpapi.continue but stpapi.print.report should work. But I would change the code to look like this to start with:

stpapi.put.field("tfacp1430m000","suno.f","")
stpapi.put.field("tfacp1430m000","suno.t","ZZZZZZZZZ")
stpapi.put.field("tfacp1430m000","fico.f","700")
stpapi.put.field("tfacp1430m000","fico.t","720")
stpapi.put.field("tfacp1430m000","comp.f","700")
stpapi.put.field("tfacp1430m000","comp.t","700")
stpapi.put.field("tfacp1430m000","otyp.f",str$(etol(tfacp.otyp.purchase)))
stpapi.put.field("tfacp1430m000","otyp.t",str$(etol(tfacp.otyp.purchase)))
stpapi.put.field("tfacp1430m000","orno.f",imp.orno1)
stpapi.put.field("tfacp1430m000","orno.t",imp.orno2)
stpapi.put.field("tfacp1430m000","cofc.f","")
stpapi.put.field("tfacp1430m000","cofc.t","ZZZZZZ")
stpapi.put.field("tfacp1430m000","date.t",str$(utc.num()))
stpapi.put.field("tfacp1430m000","home.ccur","PHP")
stpapi.put.field("tfacp1430m000","print.invoices",str$(etol(tcyesno.no)))
stpapi.put.field("tfacp1430m000","print.zero",str$(etol(tcyesno.no)))
stpapi.put.field("tfacp1430m000","print.to.match",str$(etol(tcyesno.yes)))
stpapi.set.report("tfacp1430m000","rtfacp143012000","N",error.msg)
stpapi.print.report("tfacp1430m000", error.msg)
stpapi.end.session("tfacp1430m000")

jojovalenton
24th October 2019, 16:09
hi mark,
thanks for your reply appreciated. i tried it but error message appeared 'report name not filled'.
regards,
jojo

mark_h
25th October 2019, 14:54
Interesting - I cut and pasted your code into our development system (we are 4c4). I commented out a few lines and this ran without issue. Our form has a lot fewer fields that yours does. Did you try the continue like below? I am not sure that makes a difference or not - my system works with both methods.

function print.tfacp1430()
{
stpapi.put.field("tfacp1430m000","logistic.comp","701")
stpapi.put.field("tfacp1430m000","suno.f","")
stpapi.put.field("tfacp1430m000","suno.t","ZZZZZZZZZ")

|stpapi.put.field("tfacp1430m000","otyp.f",str$(etol(tfacp.otyp.purchase)))
|stpapi.put.field("tfacp1430m000","otyp.t",str$(etol(tfacp.otyp.purchase)))
stpapi.put.field("tfacp1430m000","orno.f","440002")
stpapi.put.field("tfacp1430m000","orno.t","440002")
|stpapi.put.field("tfacp1430m000","cofc.f","")
|stpapi.put.field("tfacp1430m000","cofc.t","ZZZZZZ")
|stpapi.put.field("tfacp1430m000","date.t",str$(utc.num()))
|stpapi.put.field("tfacp1430m000","home.ccur","PHP")
stpapi.put.field("tfacp1430m000","print.invoices",str$(etol(tcyesno.no)))
stpapi.put.field("tfacp1430m000","print.zero",str$(etol(tcyesno.no)))
|stpapi.put.field("tfacp1430m000","print.to.match",str$(etol(tcyesno.yes)))
stpapi.set.report("tfacp1430m000","rtfacp143012000","D66",err)
stpapi.continue.process("tfacp1430m000", err)
stpapi.end.session("tfacp1430m000")
}

jojovalenton
27th October 2019, 06:58
hi mark,
although still not working but thank you very much for the support. i will try to wait and look other ways.
regards,
jojo