Jasper Query + Context Variables $P{#AD_Client_ID}

273 views
Skip to first unread message

Robinson Arboleda

unread,
Jan 27, 2016, 11:15:26 AM1/27/16
to iDempiere
Hi everyone, im triying to do the following thing in a jasper query

SELECT c_inovice_id, description
FROM   c_invoice i
WHERE i.AD_Client_ID = $P{#AD_Client_ID}

I have declared #AD_Client_ID as a parameter in ireport but it doesn't work, the page is blank.
I have to do something like this because we have two different companies that use the same report, hence the question.

Any aditional step I forgot ?

Thanks inadvance

Jose Francisco Rodriguez Chavez

unread,
Jan 27, 2016, 11:33:53 AM1/27/16
to idempiere
Hi Robinson.

You must create a new parameter "AD_Client_ID" in "Application Dictionary > Report & Process" and fill all fields such as follow image:

Imágenes integradas 1

DB Column Name must have the same value of iReport Parameter. Default Logic have a context variable "@#AD_Client_ID@" and Read Only Logic is 1=1 because each company will see its own information when it login in the system.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/41616868-9e44-4f78-938a-744d6fb469f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Siempre fraterno,
José Francisco Rodríguez Chávez

Especialista en Informática

"La vida del hombre no consiste en la abundancia de los bienes que posee" Lucas 12:15 "¿qué aprovechará el hombre, si ganare todo el mundo, y perdiere su alma?" Marcos 8:36 "No os afanéis por vuestra vida, qué habéis de comer, o qué habéis de beber; ni por vuestro cuerpo, qué habéis de vestir. ¿No es la vida más que el alimento, y el cuerpo más que el vestido? Mas buscad primeramente el reino de Dios y su justicia, y todas estas cosas os serán añadidas." Mateo 6:25,33

Jose Francisco Rodriguez Chavez

unread,
Jan 27, 2016, 11:39:01 AM1/27/16
to idempiere
Too, you can see in this link a designed Jasper report for many companies.

Robinson Arboleda

unread,
Jan 27, 2016, 2:46:24 PM1/27/16
to iDempiere
Awesome Francisco, worked like a charm, thank you.

Anozi Mada

unread,
Jan 27, 2016, 7:29:29 PM1/27/16
to iDempiere
You can also use default AD_CLIENT_ID (all upcase) as your jasper parameter, no setup required.
If you take a look at ReportStarter.java you'll see it set several parameter by default from the context such as RECORD_ID, AD_PINSTANCE_ID, AD_CLIENT_ID, AD_ROLE_ID, AD_USER_ID, CURRENT_LANG


Regards,
Anozi Mada

Robinson Arboleda

unread,
Jan 28, 2016, 8:45:40 AM1/28/16
to iDempiere
Thanks Anozi it worked very well.
Reply all
Reply to author
Forward
0 new messages