Report

Devo eseguire un report (una banale lista di clienti) e con la window di lancio scelgo il tipo di ordinamento (per codice, per ragione sociale, per categoria).
Vorrei che l’intestazione del report fosse diversa a seconda del tipo di ordinamento, vale a dire “Elenco clienti per Codice” nel primo caso, “Elenco Clienti per Ragione Sociale” nel secondo e “Elenco Clienti per Categoria” nel terzo.
Non so come comunicare al report il tipo di ordinamento scelto (passargli un parametro, impostargli una propriet).
Qualcuno mi pu aiutare?
Grazie!

Nedi

Try to describe your topic in english. We are happy to help you.

I have to run a report (a banal list of customers) and with the launch window I choose the type of ordering (by code, by company name, by category).
I would like the header of the report to be different depending on the type of order, ie “List of customers by code” in the first case, “List of Customers by Company Name” in the second and “List of Customers by Category” in the third.
I do not know how to tell the report the type of sorting chosen (pass a parameter, set a property).
Can anyone help me?
Thank you!

Ciao Nedi, mi pare che puoi cambiare il titolo del report inserendo un campo extra che chiami titolo quando lo passi al report
nell’sql direttamente con la select…

select campo1, campo2, campo3, ‘Elenco clienti per Codice’ as titolo … .
e ovviamente crei il campo titolo nel report.

[quote=405301:@Nedi Freguglia]I have to run a report (a banal list of customers) and with the launch window I choose the type of ordering (by code, by company name, by category).
I would like the header of the report to be different depending on the type of order, ie “List of customers by code” in the first case, “List of Customers by Company Name” in the second and “List of Customers by Category” in the third.
I do not know how to tell the report the type of sorting chosen (pass a parameter, set a property).
Can anyone help me?
Thank you![/quote]
I made a small sample project for you: https://www.dropbox.com/s/kt9pkmedmpwef2d/49945-Report.zip?dl=0

Grazie Max, avevo fatto aggirato l’ostacolo con una cosa molto simile, vale a dire aggiungendo nella SELECT il tipo ordinamento (C, R, G) e poi da l il gioco fatto.
Volevo capire se esiste la possibilit di passare parametri al report o impostarne delle propriet, ma non mi pare di aver visto niente del genere.
Grazie mille.

Thank you, Martin. Unfortunately I cannot login to Dropbox (I don’t know why).
Would you mind sending your zip file to my email address? (freguglia.nedi@gmail.com)
Thank you so much!

Allora, non ho tempo per provare … per
Ho preso una windows
ho aggiunto un report
ho definito nel report la propriet titolo
ho inserito un campo nel report e ho inserito nell’evento BEFOREPrint
me.text = self.titolo


Secondo me dovrebbe andare. …

Ok, ma come hai impostato la propriet titolo del report dalla window?

Pulsante destro sul report, dal menù add->property.

Non fare anche te come Luciano Monti che passa i pomeriggi a debuggare un’app in crash… poi mi chiama disperato e gli dico… il movenext lo hai messo ???

No, intendevo dire: come hai messo un valore dalla window dentro alla propriet “titolo” del report?

quando lo chiami lo passi
dim wrep as new Report1
wrep.tiporeport = “TITOLO”
If wrep.Run etc etc

non chiamo mai gli oggetti per nome, si offendono.
chiamo un nuovo oggetto di x e gli passo i parametri.
ad esempio la finestra clienti
dim wclienti as new clienti
wclienti.nome.text = “Massimiliano”
… etc etc …

pi pratico.
ad esempio ho una classe di tipo windows dove ho messo una property che ho chiamato ‘chiamante’ di tipo weakref
quando chiamo la finestra :

dim wclienti as new clienti
wclienti.chiamante = new weakref(self)


se devo riportare un valore all finestra che ha chiamato la finestra clienti :
if Chiamante<>nil and Chiamante.Value<>nil and Chiamante.Value isA elencoclienti then
clienti(Chiamante.Value).Aggiorna // chiamo il metodo aggiorna della finestra che ha aperto clienti
end if

A regola puoi anche fare cos … metti caso il titolo del report si chiama titolo…

dim wrep as new report1
wrep.titolo.text = “TITOLO DEL REPORT”

e poi eseguo il report con run…

Il mio report si chiama “ElencoClienti” ed ha la propriet “Order”.
Dalla window eseguo

rpt = New ElencoClienti
rpt.order = "C"

Qui per mi dice che l’oggetto rpt non ha nessun “order”…

La variabile oggetto “rpt” non ha accesso a tutti i controls del report

hai provato ad impostare direttamente il titolo con rpt.campo.text ?

Nedi, you don’t have to log in to Dropbox to download the project. There is a button at the top right of the page called “Download” and there you can select “Direct Download”.

Con rpt non vedo nessuno degli oggetti presenti nel report