Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New nfTools release
Message
From
20/02/2021 02:59:50
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
New nfTools release
Miscellaneous
Thread ID:
01678492
Message ID:
01678492
Views:
71
Glad to share a new release at nfTools!
It never has been so easy to create complex aggregated objects to
construct rich responses. pass parameters , and set configuration objects.
( attached debugger output )

* there's more functionallity I'll share soon. Follow the project to get notifications.

sample code:
* Marco Plaza, 2021
* https://github.com/nfTools/e
* @nfoxDev
*
* nfTools e():

Public myFoxPc,myePc,my_pc, oResponse

* construct rich response or pass objects with ease:

Select * From Home()+'samples\northwind\customers' Into Array Cust
Cursortoxml(Alias(),"xml")

oResponse = e('cursor','customers','rows',@Cust,'count',_Tally,'dt',Datetime(),'xml',m.xml)


* aggregated objects:

myePc = e('modelName','Ryzen Performance Plus','color','black',;
	'keyboard.specs.colors(2)','white','black',;
	'keyboard.specs.lang(3)','es','us','sp',;
	'cpu',;
	e('model','ryzen 7','clockSpeed',4.3,'coreCount',8),;
	'motherboard',;
	e('formfactor','atx','make','asus'),;
	'hdds(3)',;
	e('capacity','500G','type','ssd','connectors(3)','sata','power','esata'),;
	e('capacity','256G','type','M2'),;
	e('capacity','2T','type','standard'),;
	'monitors(2)',;
	e('size',24,'brand','acer'),;
	e('size',20,'brand','aoc');
	)

* Compare using vfp9 Original syntax:

myFoxPc = Createobject('empty')

With myFoxPc

	AddProperty(myFoxPc,'modelName','Ryzen Performance Plus')
	AddProperty(myFoxPc,'color','black')
	AddProperty(myFoxPc,'keyboard',Createobject('empty'))
	
	AddProperty(.Keyboard,'specs',Createobject('empty'))

	With .Keyboard

		AddProperty(.specs,'colors(2)')
		.specs.Colors(1) = 'black'
		.specs.Colors(2) = 'white'

		AddProperty(.specs,'lang(3)')
		.specs.Lang(1) = 'sp'
		.specs.Lang(2) = 'es'
		.specs.Lang(3) = 'us'

	Endwith


	AddProperty(myFoxPc,'cpu',Createobject('empty'))
	AddProperty(.cpu,'model','Ryzen 7')
	AddProperty(.cpu,'clockSpeed',4.3)
	AddProperty(.cpu,'coreCount',8)

	AddProperty(myFoxPc,'motherboard',Createobject('empty'))
	AddProperty(.motherboard,'formfactor','atx')
	AddProperty(.motherboard,'make','asus')

	AddProperty(myFoxPc,'hdds(2)')

	.hdds(1) = Createobject('empty')
	AddProperty(.hdds(1),'capacity','500gb')
	AddProperty(.hdds(1),'type','ssd')
	AddProperty(.hdds(1),'connectors(3)')
	
	.hdds(1).connectors(1) = 'sata'
	.hdds(1).connectors(2) = 'power'
	.hdds(1).connectors(3) = 'esata'

	.hdds(2) = Createobject('empty')
	AddProperty(.hdds(2),'capacity','256gb')
	AddProperty(.hdds(2),'type','M2')

Endwith
Check:

https://twitter.com/nfoxdev/status/1363033215062130688
@nfoxdev
github.com/nfoxdev
Reply
Map
View

Click here to load this message in the networking platform