Warning sugli ASSIGN generati dal VODbServerEditor

Forum dedicato ai programmatori di X# in lingua italiana – Italian language forum

Moderator: wriedmann

Post Reply
veliero
Posts: 22
Joined: Sun Feb 25, 2018 11:28 pm

Warning sugli ASSIGN generati dal VODbServerEditor

Post by veliero »

Salve, sto smanettando con il VODbServerEditor in ambiente XIDE e si verifica questa situazione anomala:
- importo un file DBF (cui è associato un indice CDX)
- salvo il codice generato (e fin qui tutto bene)
- procedo poi con la compilazione ma mi da una serie di Warning XS9032 - This entity type cannot return a value. Return value ignored.

questo accade nelle istruzioni RETURN per gli ASSIGN di tutti i campi del mio database (sotto un codice di esempio):

ASSIGN CODICE(uValue )

RETURN SELF:FieldPut(#CODICE, uValue)

Come posso risolvere questa problematica?

Saluti
Francesco
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Warning sugli ASSIGN generati dal VODbServerEditor

Post by Chris »

Hi Francesco,

This is the same as in VO, the code is generated based on the file CAVOFED.TPL. Please locate this file (it will be somewhere inside the folder of your Project, and if it's not there, it should be in XIDEConfig), edit it and change the entry at the end from

[DBSERVER]
ASSIGN %hlname%...
RETURN SELF:FieldPut(#%hlname%, uValue)

to

[DBSERVER]
ASSIGN %hlname%...
SELF:FieldPut(#%hlname%, uValue)

Then delete the ASSIGNs from the code, and the next time you save the DBServer, they will be generated again without the RETURN.

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
veliero
Posts: 22
Joined: Sun Feb 25, 2018 11:28 pm

Warning sugli ASSIGN generati dal VODbServerEditor

Post by veliero »

Ciao Chris,
perfetto, ora il WARNING sugli ASSIGN è sparito tuttavia c'è un'altra segnalazione sulla variabile "lTemp" nel CONSTRUCTOR della mia CLASSE Clienti derivata da DBserver:

CLASS Clienti INHERIT DBServer
INSTANCE cDBFPath := "C:UsersUtenteDesktopchicco d'oro" AS STRING
INSTANCE cName := "CLIENTI.DBF" AS STRING
INSTANCE xDriver := "DBFcdx" AS USUAL
INSTANCE lReadOnlyMode:= FALSE AS LOGIC
INSTANCE lSharedMode := TRUE AS USUAL
INSTANCE nOrder := 0 AS INT


// User code starts here (DO NOT remove this line) ##USER##
CONSTRUCTOR(cDBF, lShare, lRO, xRdd)
LOCAL oFS AS FILESPEC
LOCAL i AS DWORD
LOCAL nFields AS DWORD
LOCAL aFieldDesc AS ARRAY
LOCAL aIndex AS ARRAY
LOCAL nIndexCount AS DWORD
LOCAL oFSIndex AS FILESPEC
LOCAL nPos AS DWORD
LOCAL lTemp AS LOGIC <=========================
LOCAL oFSTemp AS FILESPEC

in fase di compilazione si presenta il messaggio:

warning XS0165: Use of unassigned local variable 'lTemp'

l'errore si verifica in questo ciclo:

FOR i:=1 UPTO nIndexCount
oFSIndex := FileSpec{ aIndex[DBC_INDEXNAME] }
oFSIndex:Path := SELF:cDBFPath

IF lTemp .AND. !Empty( aIndex[DBC_INDEXPATH] ) <============
oFSIndex:Path := aIndex[DBC_INDEXPATH]
ENDIF

IF oFSIndex:Find()
lTemp := SELF:SetIndex( oFSIndex )
ENDIF
NEXT

Ti torna questo problema?
Attachments
Cattura1.JPG
Cattura1.JPG (56.69 KiB) Viewed 2238 times
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Warning sugli ASSIGN generati dal VODbServerEditor

Post by Chris »

Hi Francesco,

You can fix this also. Please open CAVODED.TPL this time, and in the section:

Code: Select all

[INIT]
METHOD Init(cDBF, lShare, lRO, xRdd) CLASS %classname%
	LOCAL oFS		  AS FILESPEC
	LOCAL i 		  AS DWORD
	LOCAL nFields	  AS DWORD
	LOCAL aFieldDesc  AS ARRAY
	LOCAL aIndex	  AS ARRAY
	LOCAL nIndexCount AS DWORD
	LOCAL oFSIndex	  AS FILESPEC
	LOCAL nPos		  AS DWORD
	LOCAL lTemp 	  AS LOGIC
	LOCAL oFSTemp	  AS FILESPEC
...
add an assignment for the local declaration of lTemp:

Code: Select all

	LOCAL lTemp := FALSE AS LOGIC
Now also this warning should go away!

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Warning sugli ASSIGN generati dal VODbServerEditor

Post by wriedmann »

Hi Chris,
PMFJI: maybe there should be an option in XIDE for global template files like in VO, instead of putting them in every application.
And XIDE should install versions that are compatible with the X# compiler.
If anyone has changed them in VO it would be much easier to make these changes then again in XIDE.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Warning sugli ASSIGN generati dal VODbServerEditor

Post by Chris »

Hi Wolfgang,

Yes, you can put the templates in XIDEConfig and they will become available for all projects and applications. But you can also put different templates inside a project and those will then override the global ones, for this project.

About installing them together with XIDE, I feel uneasy about doing this, because those files are from another product, so I'd like avoiding them including them in XIDE. But it's very easy to copy them manually from the VO folder and also VOXporter does this when you port an app.

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Warning sugli ASSIGN generati dal VODbServerEditor

Post by wriedmann »

Hi Chris,
since X# requires adapted template files XIDE (and also the VS integration) should supply them, at least optionally.
If you feel uneasy to install them, maybe it could be an option to copy them optionally from a VO installation if not already present and make then the required changes.
Personally I think that would help a lot the people that migrates from VO - and I don't think many people has changed any of these template files other than the cavowed.inf.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Warning sugli ASSIGN generati dal VODbServerEditor

Post by Chris »

Hi Wolfgang,

I understand you, but I'd rather avoid having to deal with anything related to legal matters...

Also please remember that those messages from the compiler are only warnings, not errors. And those warnings will appear when you port an app, no matter if you have adjusted the templates or not, they will be reported because they will already exist in the VO code itself. Or actually most of them will not be reported at all, because VOXporter disables them (the ones about missing initialization) by default :)

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
veliero
Posts: 22
Joined: Sun Feb 25, 2018 11:28 pm

Warning sugli ASSIGN generati dal VODbServerEditor

Post by veliero »

Ciao Chris,
grazie; ora la compilazione va a buon fine.

Saluti
Francesco
Post Reply