Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 9 Monaten, 4 Wochen
Letzter Beitrag:
vor 9 Monaten, 4 Wochen
Beteiligte Autoren:
Gianni Spano, Piet van Zanten

[WD] How to change "search key" on a report

Startbeitrag von Gianni Spano am 21.10.2016 06:15

Hello to all

I have a report to print customers data from my application.
The report has a "search key" (with low and upper bound checked) based on the customer_name field and this is ok.

What i'm trying to do : Is it possible to "change" at runtime the "search key" field selecting one from the available other keys file? (like customer_code order)
I didn't find any information on the help.

Please, Can someone tell me if is it possible??

Thanks in advance

Gianni

Antworten:

Doing a deep search on the online help, i found this example, that i think is related to my needed:

// -- Opening code of the report
// Change the file browsed
RPT_Report1..SourceName = Customer
// New search item for "Customer" file
RPT_Report1..BrowsedItem = CustomerID


Is it the way i have to follow??

Thanks

Gianni

von Gianni Spano - am 21.10.2016 06:25
Hello

I think there is an OLD bug with "browseditem" on the report design.

This is the code i'm using to set the "search key" on the report:

SWITCH ASL_ReportMedici.RADIO_TipoStampa
CASE 1
RPT_medici..SourceName=medici
RPT_medici..BrowsedItem=medici.id
CASE 2
RPT_medici..SourceName=medici
RPT_medici..BrowsedItem=medici.id_cup

OTHER CASE

END


iPreview(ipvZoom100, "Anteprima")
iPrintReport(RPT_medici)



When i run the application, an error occurs (in french??):
Erreur à la ligne 3 du traitement Click BTN_Avvia.
Le champ 'RPT_medici' est inconnu.

How to resolve this issue?

Any hint or tip is appreciated.. :-)

Gianni

von Gianni Spano - am 21.10.2016 10:17
Hi Gianni,

Looks to me that you are trying to change the report properties outside the report.
Since the report is not opened yet you get the error that the report is unknown.
So you need to put your code in the report opening code and pass the BrowsedItem value to the report as a parameter (string).

Best regards,
Piet

von Piet van Zanten - am 21.10.2016 11:03
Hello Piet

Thanks for the suggestion. It works!

I have used two global variables (gsSourceName and gsBrowsedItem)
Before to print the report both variables are set like:



gsSourceName="medici"
gsBrowsedItem="id" // or "id_cup" depending on the user choice


and in the opening section of the report:

MySelf..SourceName=gsSourceName
MySelf..BrowsedItem=gsBrowsedItem



And finally the report is printed as it is selected.

Thanks again

Gianni

von Gianni Spano - am 21.10.2016 11:38
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.