PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Problem with State..SourceName
Problem with State..SourceName
Débuté par Alexandre Leclerc, 28 fév. 2008 22:16 - 5 réponses
Posté le 28 février 2008 - 22:16
Hi all,

I'm trying to get a State to work with another Query but it fails to work. (WinDev 12). I made a Query in the project, then made a State based on that Query.

Then in the Opening event of my State I try to build a new Query and assign the SourceName of the State, but it will not work.

The report opens, but always use the old Data Source.

Here is the code, if someone has an idea.



PROCEDURE State_STKLST(gsSort is string, gsStart is string, gsStop is string)

gsdSource is Data Source

gsSql is string = [

**query, which works**

]

IF NOT HExecuteSQLQuery(gsdSource,gsSql) THEN

Error(HErrorInfo)

RETURN

END

MySelf..SourceName = gsdSource
Posté le 29 février 2008 - 14:08
>Hi all,

I'm trying to get a State to work with another Query but it fails to work. (WinDev 12). I made a Query in the project, then made a State based on that Query.


>Then in the Opening event of my State I try to build a new Query and assign the SourceName of the State, but it will not work.

The report opens, but always use the old Data Source.


>Here is the code, if someone has an idea.



>PROCEDURE State_STKLST(gsSort is string, gsStart is string, gsStop is string)

gsdSource is Data Source


>gsSql is string = [

**query, which works**


>]

IF NOT HExecuteSQLQuery(gsdSource,gsSql) THEN


> Error(HErrorInfo)

RETURN


>END

MySelf..SourceName = gsdSource


You cannot change the report..SourceName from within that report.

Change the connection before opening it.

Leo
Posté le 29 février 2008 - 15:30
Hi Leo,

In the help it's written that we can change the SourceName, but only in the Opening "event". Ok, I'd be glad to change the connexion before calling the report, but I did try and did not have any success. Do you have a winning recipe?

I did create the request as bellow, then passed to the report the Data Source as a parameter in order to change it: State..SourceName = gSource. Then call the report: no success.

--

Alexandre Leclerc
Posté le 29 février 2008 - 16:31
Hi again,

PCSoft released a 44p version that fixes a Runtime Error problem. Now I can pass a query to the report. Now I get a message that there is no data to print. Yet, there are records to be printed.

Any one ever got that problem?
Posté le 29 février 2008 - 17:42
Hi Alexandre...

Considering that WinDev 12 US is not available yet and therefore that nearly everybody here is still working with 11, I would think that a better place for asking question about that version would be on PCSoft french forum...

Best regards

Fabrice

>Hi again,

PCSoft released a 44p version that fixes a Runtime Error problem. Now I can pass a query to the report. Now I get a message that there is no data to print. Yet, there are records to be printed.


>Any one ever got that problem?
Posté le 29 février 2008 - 17:54
Hi Fabrice,

Thank you for the remark. This I already did with few success to this point. I also contacted PCSoft TS, but it takes a while to process all the request they get. That's why I came here for this issue. I think I'll reinstall WD11 to see if it works better for that specific issue.

Best regards.

--

Alexandre Leclerc