Jump to content


Photo

Save and Load CSV File With Father And Son in Tree Structure Columm

Delphi Tree Columm Structure Tree Columm

  • Please log in to reply
37 replies to this topic

#1 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 08 December 2015 - 11:47 PM

Boki Hello!
 
We are really enjoying the new features of version 6, including the possibility of saving to CSV, which for us has brought many possibilities.
 
We wonder if you can export the contents of the Tree Columm to CSV and then import to the parent structure and child. If no such possibility, we suggest including some a feature that allows us to identify who is the father and who is the son. Example: an index for the Child.
root 1
     - Root 2 (Index Child 0)
         Child 0
         Child 1
         Child 2
root 3
Root 4 (Index 1 Child)
         - Child 0 (Index Child 1,1)
                 Child 1
                 Child 2
         Child 1
         Child 2
root 5
Root 6 (Index Child 2)
         Child 0
         Child 1
         Child 2
 
We have attached a simple design and a picture.
 
If you can help us in this regard, thank you.
 
Adilson Pedro

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 10 December 2015 - 03:16 AM

Hi Adilson,

 

CSV format is more suitable for flat style data. I am not sure how I will write tree structure into file.

 

Maybe for this kind of data XML is better? There is already a SaveToXML but it only saves a Columns. Maybe I can expand it to content too?

 

In XML I can easily store tree structure.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 10 December 2015 - 03:02 PM

Thanks for the feedback.
 
We prefer the XML. We would appreciate a lot if this feature was implemented.
 
But you think it would be imported back to the grid with the structure of trees? Would be great !!!


#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 13 December 2015 - 12:15 AM

Hi,

 

I have started writing XML export procedure. It will take some time. Then I will write Import too.

 

I hope that it will be good.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 13 December 2015 - 06:43 AM

Thank you for your return and the great news!



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 14 December 2015 - 02:33 PM

Hi Adilson,

 

I have uploaded 1st alpha of this feature.

 

Now when you call NextGrid61.Serialize.SaveToXML(FileName, dtContent) it will save content.

 

Please tell me if we are progressing in correct direction. For first, I am saving only a data, without any formatting. 


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 14 December 2015 - 10:59 PM

Boki Hello! Thanks for the feedback! We did a test in the demo version we sent you and saved without problems. The path is the same. The daley in the rescue caught our attention, but a major step has been taken. We are attentive to the news. Thanks again!

#8 DeddyH

DeddyH
  • Members
  • 14 posts

Posted 05 January 2016 - 02:22 PM

Maybe you could also add JSON-Support in the future?  :rolleyes:



#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 06 January 2016 - 06:31 AM

Hi,

 

Writing part will be fairly easy, but reading is always harder. I think that I will first made non-visual component similar like I do for TNxCSVDocument6.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#10 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 18 January 2016 - 05:14 PM

Hi Boki!

 

You can take a look at the attached picture, which appears when we open the XML file (Saved by SaveToXML method)
 
Also attach the project in Delphi6
 
 
Best Regards.


#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 18 January 2016 - 09:38 PM

Hi Adilson,

 

Thank you. I didn't yet finalised this feature, but will hurry now for you.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#12 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 18 January 2016 - 09:58 PM

Hi Boki,

 

Thank you!



#13 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 02 March 2016 - 12:58 AM

Hi Adilson,

Last days I am working on XML export/import. In day or two you will be able to save and reload saved.

Unfortunately I was needed to alter format a little bit, but now I am including Version attribute for future.

Example:
 
<?xml version="1.0" encoding="UTF-8"?>
<TNextGrid6 Type="dtContent" Version="1.1.0">
	<Rows>
		<Row>
			<Cell>
				<Property Type="String">Mike</Property>
			</Cell>
			<Cell>
				<Property Type="String">56732</Property>
			</Cell>
		</Row>
		<Row>
			<Cell>
				<Property Type="String">John</Property>
			</Cell>
			<Cell>
				<Property Type="String">65156</Property>
			</Cell>
			<Row>
				<Cell>
					<Property Type="String">Ann</Property>
				</Cell>
				<Cell>
					<Property Type="String">77424</Property>
				</Cell>
			</Row>
		</Row>
	</Rows>
</TNextGrid6>
This example is for saving content (Kind parameter of SaveToXML method), but can be layout too:

<?xml version="1.0" encoding="UTF-8"?>
<TNextGrid6 Type="dtLayout" Version="1.1.0">
	<Object Type="TNextGrid6">
		<Property name="ActiveViewIndex" type="Integer">0</Property>
		<Property name="BorderColor" type="Integer">-16777200</Property>
		<Property name="BorderSize" type="Integer">1</Property>
		<Property name="Caption" type="String">NextGrid61</Property>
		<Property name="Color" type="Integer">-16777211</Property>
		<Property name="Cursor" type="Integer">0</Property>
		<Property name="DragCursor" type="Integer">-12</Property>
		<Property name="Height" type="Integer">161</Property>
		<Property name="HelpContext" type="Integer">0</Property>
		<Property name="HelpKeyword" type="String" />
		<Property name="Hint" type="String" />
		<Property name="InactiveSelectionColor" type="Integer">-16777201</Property>
		<Property name="Left" type="Integer">8</Property>
		<Property name="Name" type="String">NextGrid61</Property>
		<Property name="RowCount" type="Integer">3</Property>
		<Property name="RowHeight" type="Integer">16</Property>
		<Property name="SelectionColor" type="Integer">-16777203</Property>
		<Property name="SelectionTextColor" type="Integer">-16777202</Property>
		<Property name="TabOrder" type="Integer">0</Property>
		<Property name="Tag" type="Integer">0</Property>
		<Property name="TagString" type="String" />
		<Property name="Top" type="Integer">72</Property>
		<Property name="Version" type="String">6.0.14</Property>
		<Property name="Width" type="Integer">269</Property>
	</Object>
	<Columns>
		<Object Type="TNxTextColumn6">
			<Property name="Color" type="Integer">-16777211</Property>
			<Property name="DefaultValue" type="String" />
			<Property name="EmptyCaption" type="String" />
			<Property name="Filter" type="String" />
			<Property name="FixedWidth" type="Integer">80</Property>
			<Property name="Index" type="Integer">0</Property>
			<Property name="InsertCaption" type="String" />
			<Property name="MaxLength" type="Integer">0</Property>
			<Property name="MinWidth" type="Integer">8</Property>
			<Property name="Name" type="String">NxTextColumn61</Property>
			<Property name="PasswordChar" type="Char">0</Property>
			<Property name="PlaceholderText" type="String">Text Text</Property>
			<Property name="Position" type="Integer">0</Property>
			<Property name="SortedIndex" type="Integer">-1</Property>
			<Property name="Tag" type="Integer">0</Property>
			<Property name="TextAfter" type="String" />
			<Property name="TextBefore" type="String" />
			<Property name="VisibleIndex" type="Integer">0</Property>
			<Property name="Width" type="Integer">80</Property>
		</Object>
		<Object Type="TNxNumberColumn6">
			<Property name="Color" type="Integer">-16777192</Property>
			<Property name="DefaultValue" type="Float">0</Property>
			<Property name="EmptyCaption" type="String" />
			<Property name="EmptyValue" type="Float">0</Property>
			<Property name="Filter" type="String" />
			<Property name="FixedWidth" type="Integer">80</Property>
			<Property name="FormatMask" type="String">#,##0.00</Property>
			<Property name="Index" type="Integer">1</Property>
			<Property name="InsertCaption" type="String" />
			<Property name="Max" type="Float">0</Property>
			<Property name="Min" type="Float">0</Property>
			<Property name="MinWidth" type="Integer">8</Property>
			<Property name="Name" type="String">NxNumberColumn61</Property>
			<Property name="PlaceholderText" type="String">1742.50</Property>
			<Property name="Position" type="Integer">1</Property>
			<Property name="Precision" type="Integer">2</Property>
			<Property name="SortedIndex" type="Integer">-1</Property>
			<Property name="Tag" type="Integer">0</Property>
			<Property name="TextAfter" type="String" />
			<Property name="TextBefore" type="String" />
			<Property name="VisibleIndex" type="Integer">1</Property>
			<Property name="Width" type="Integer">80</Property>
		</Object>
	</Columns>
</TNextGrid6>

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#14 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 08 March 2016 - 03:08 PM

Hi Boki,
 
Thank you for your feedback. We look forward to this import and export feature.
 
Best regards.


#15 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 08 March 2016 - 03:36 PM

Hi Adilson,

Please try to download latest release and tell me how it works for now.

It need some fine tuning, maybe your ideas can help here?
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#16 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 27 May 2016 - 11:42 PM

Hello Boki,
 
I downloaded the latest update (May 27, 2016), but could not import the XML after the rescue.
 
TForm1.Button1Click procedure (Sender: TObject);
begin
    NextGrid61.Serialize.SaveToXML ('C: \ Test.xml' dtLayout);
end;
 
TForm1.Button2Click procedure (Sender: TObject);
begin
    NextGrid61.Serialize.LoadFromXML ('C: \ Test.xml' dtLayout);
end;
 
Am I doing something wrong?
 
I'm sending a picture that appears after clicking the button to import the xml (NextGrid61.Serialize.LoadFromXML ('C: \ Test.xml' dtLayout);)
 
 
Thank you!
 
Best Regards,
 
Adilson Pedro


#17 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 28 May 2016 - 12:49 AM

Hi Adilson,

Problem may be if columns are not already added. Maybe I should create and add columns too.

Maybe I can check if there are no columns added yet, and then create them from file.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#18 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 30 May 2016 - 02:51 PM

Thanks for the feedback!
 
I am very excited about this import and XML export feature.
 
All the best!
 
Adilson


#19 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,586 posts
  • Gender:Male

Posted 30 May 2016 - 04:12 PM

Hi Adilson,

Can you please tell me does it worked if you have already added columns (while loading)?
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#20 Adilson Pedro

Adilson Pedro
  • Members
  • 24 posts

Posted 30 May 2016 - 08:49 PM

Hello Boki,
 
The project contains three columns. The error occurs when I try to import the xml.
 
I am sending some attached files for you to analyze.
 
If you do not understand your question, please, I beg you please rephrase.
 
 
Thank you!






Also tagged with one or more of these keywords: Delphi, Tree Columm, Structure Tree Columm

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users