Posts: 18 
	Threads: 3 
	Joined: Apr 2018
	
 Reputation: 
 0
	 
 
	
	
		Hi, 
 
I've been trying the examples from openrb, regarding CSV file generation locally and over FTP. This seems to work flawlessly. 
But I would really like to split up the buffer string, so that each object.value goes to each own column. 
Anybody got a suggestion? 
 
 
Best regards 
Christian
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 1807 
	Threads: 7 
	Joined: Jul 2015
	
 Reputation: 
 121
	 
 
	
		
		
		04.02.2019, 22:29 
(This post was last modified: 04.02.2019, 22:31 by Erwin van der Zwart.)
		
	 
	
		Hi, 
 
The buffer string is already comma separated so you should have multi column. 
 
Did you opened the file as csv comma separeted in excel?
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 8422 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
 481
	 
 
	
	
		Can you provide an example of how resulting CSV should look like, should it look like this? 
Code: Obj1,Obj2,Obj3 
Val1,Val2,Val3
  
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 18 
	Threads: 3 
	Joined: Apr 2018
	
 Reputation: 
 0
	 
 
	
	
		Hi Guys, 
 
Sorry for the delay. Really appreciate your effort to help me out. 
 
My csv now looks like this: 
 
[ column A 
address,"name","date","value" 
0/6/16,"Heating Active Energy","2019.02.05 23:53:54","4.38843238774139e-40" 
0/6/17,"Heating Active Power Total","2019.02.05 23:54:35","2213.32983398438" 
] 
 
But would like to have "address" in cloumn A, "name" in Column B, "date" in Column C, and "value" in Column D. 
 
I use the standard ftp script from openrb examples. 
 
Also notice the value from GA 0/6/16, which is raw format. Is it possible to only log decoded values? 
 
best regards 
Christian
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 8422 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
 481
	 
 
	
	
		You need to replace two lines: 
From:
 Code: buffer = { '"date","address","name","value"' }
 To:
 Code: buffer = { '"address","name","date","value"' }
 
From:
 Code: csv = string.format('%q,%q,%q,%q', logdate, knxlib.decodega(row.address), object.name, tostring(data))
 To:
 Code: csv = string.format('%q,%q,%q,%q', knxlib.decodega(row.address), object.name, logdate, tostring(data))
 
As for 4.38843238774139e-40 it not a raw format it's scientific notation. This is used for very small floating point numbers which would be too long if displayed in 0.000... format.
	  
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 18 
	Threads: 3 
	Joined: Apr 2018
	
 Reputation: 
 0
	 
 
	
	
		 (07.02.2019, 07:55)admin Wrote:  You need to replace two lines: 
 
From: 
Code: buffer = { '"date","address","name","value"' }
  To: 
Code: buffer = { '"address","name","date","value"' }
  
From: 
Code: csv = string.format('%q,%q,%q,%q', logdate, knxlib.decodega(row.address), object.name, tostring(data))
  To: 
Code: csv = string.format('%q,%q,%q,%q', knxlib.decodega(row.address), object.name, logdate, tostring(data))
  
As for 4.38843238774139e-40 it not a raw format it's scientific notation. This is used for very small floating point numbers which would be too long if displayed in 0.000... format. 
Thank you very much for you help! I've already done these changes, but the generated csv, still have all data in one column :/
	  
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 8422 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
 481
	 
 
	
	
		What are using to open CSV?
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 18 
	Threads: 3 
	Joined: Apr 2018
	
 Reputation: 
 0
	 
 
	
	
		 (07.02.2019, 16:54)admin Wrote:  What are using to open CSV? Microsoft Excel 2010
	  
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 5287 
	Threads: 29 
	Joined: Aug 2017
	
 Reputation: 
 237
	 
 
	
	
		Upload your csv here
	 
	
	
------------------------------ 
Ctrl+F5
 
	
		
	 
 
 
	
	
	
		
	Posts: 8422 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
 481
	 
 
	
	
		Excel might require semicolon instead of comma. See this for more info:  https://stackoverflow.com/questions/1014...-semicolon
You can either change regional settings locally, modify script to use semicolon or use LibreOffice which can open any kind of CSV   
	 
	
	
	
		
	 
 
 
	
	
	
		
	Posts: 5287 
	Threads: 29 
	Joined: Aug 2017
	
 Reputation: 
 237
	 
 
	
	
		In Excel you have to open empty sheet and then go to DATA and from CSV/text. Then you select your file and you can select separator which is coma by default. Excel will also by default display group as a data so changing to text make sense. In 2010 it might be slightly different I have 365.
	 
	
	
------------------------------ 
Ctrl+F5
 
	
		
	 
 
 
	 
 |