Descend() in index expressions, using Vulcan runtime

This forum is meant for questions and discussions about the X# language and tools
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hello,

I have now tried to move a VO application I'm working on to X#, using the Vulcan runtime.

But my application fails to deal with index expressions that contain the Descend() function, like these:
upper(artnr)+str(descend(datum),10)
upper(kdnr+artnr)+str(descend(datum),10)
upper(kname+artnr)+str(descend(datum),10)

and several more of them.

Is there anything I can do other than wait for the X# runtime and RDDs?

TIA

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1522
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Descend() in index expressions, using Vulcan runtime

Post by FFF »

I seem to remember a lengthy thread in the newsgroup, many moons ago, with the result that descend is broken....?
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hi Karl,
Thank you very much. This means I have to wait until the X# runtime and RDDs are ready.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Descend() in index expressions, using Vulcan runtime

Post by Chris »

Karl, you could very well be right of course, but personally I don't remember this discussion about Descend() being broken. At least there was no open bug report logged about this in when I was a member of the team in the vulcan days, I would had known otherwise.

Wolfgang, can you please give more information? What do you mean it fails, do you get runtime errors, or the sorting is not done correctly? Can you please give us a full repro sample?

TIA
Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
FFF
Posts: 1522
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Descend() in index expressions, using Vulcan runtime

Post by FFF »

Chris,
that's why is said "seem to remember" ;) - if right, it was way before VN appeared. I think Steph(?) and Geoff were involved. As i hadn't use for it, i never bothered to check for relevance.

Karl
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hi Chris,
I have to isolate the code as it is deep in my class library, and only orders that contain descend() are atfected, and all of them.
The same code works in VO for at least 10 years now, but since that is an application I'm currently working on I have tried to move it to X#.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Guy Deprez

Descend() in index expressions, using Vulcan runtime

Post by Guy Deprez »

Wolfgang,
Did you try descend(dtos(datum))? datum is first converted to string and then descend is called.
Guy
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hi Guy,

I cannot change that as this is part of a more than 10 year old VO application, and if I change the index expressions, I will have to change also the application itself.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hi Chris,

I was now able to reproduce the issue in a small sample:
The following index expression works:

Code: Select all

DbCreateOrder( "DATEFIELD", cCdxName, "Descend( DateField )" )
and the following fails with a runtime error:

Code: Select all

DbCreateOrder( "SDATEFIELD", cCdxName, "Str( Descend( DateField ), 10 )" )
The runtime error says:

Code: Select all

Vulcan.NET Runtime Error

Error Code: 34 [Data width error]
Error Subcode: 1121 [Data width error]
Subsystem:
Funktion: ORDCREATE
Please find attaches a small console application (as XIDE export file) that creates a small DBF in your c:temppath and then creates the order.
DescendTester.zip
(1.49 KiB) Downloaded 22 times
Wolfgang

P.S. for them that are not using XIDE, this is the full sample code:

Code: Select all

function Start( ) as void                     
	local cAlias			as string
	local cDbfName			as string
	local cCdxName			as string
	local aStruct			as array
	local nArea				as dword
	
	try

	cAlias				:= "DbfTest"	
	cDBFName			:= String.Format( "c:temp{0}.dbf", cAlias )
	cCdxName			:= String.Format( "c:temp{0}.cdx", cAlias )

	System.Console.WriteLine( "Creating table " + cDbfName + "..." )
	aStruct				:= ArrayNew( 3 )
	aStruct[1]			:= { "CHARFIELD", "C", 10, 0 }
	aStruct[2]			:= { "NUMFIELD", "N", 10, 0 }
	aStruct[3]			:= { "DATEFIELD", "D", 10, 0 }
	DBCreate( cDbfName, aStruct, "DBFCDX", true, cAlias,, false )
	if ( nArea := Select( cAlias ) ) > 0
		( nArea )->( DBCloseArea() )
	endif
	if DBUseArea( true, "DBFCDX", cDbfName, cAlias, false, false ) 
		nArea				:= Select( cAlias )
		( nArea )->( DBAppend() )
		( nArea )->Charfield	:= "Hi X#"
		( nArea )->NumField		:= 2018
		( nArea )->DateField	:= Today()
		( nArea )->( Dbcommit() )
		if ( nArea )->( DbCreateOrder( "CHARFIELD", cCdxName, "Descend( CharField )" ) ) == false
			System.Console.WriteLine( "Error creating order!" )
		endif
		if ( nArea )->( DbCreateOrder( "NUMFIELD", cCdxName, "Descend( NumField )" ) ) == false
			System.Console.WriteLine( "Error creating order!" )
		endif
		if ( nArea )->( DbCreateOrder( "DATEFIELD", cCdxName, "Descend( DateField )" ) ) == false
			System.Console.WriteLine( "Error creating order!" )
		endif  
		if ( nArea )->( DbCreateOrder( "SDATEFIELD", cCdxName, "Str( Descend( DateField ), 10 )" ) ) == false
			System.Console.WriteLine( "Error creating order!" )
		endif  
	else
		System.Console.WriteLine( "Error opening table" )
	endif
	
	catch oEx as Exception
		
	System.Console.WriteLine( oEx:Message )
	System.Console.WriteLine( oEx:StackTrace )
	
	end try	
	
return
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Descend() in index expressions, using Vulcan runtime

Post by wriedmann »

Hello,

an addition: in VO this code works. And the VO help says about Descend():
This example uses Str() instead of DToS() since Descend() of a date returns a numeric value
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply