Re: Data Dictionary to Structure via XML ?

2016-10-30 Thread Arnaud de Montard

> Le 12 oct. 2016 à 13:10, Peter Jakobsson  a écrit :
> 
> [...]
> To me, SQL is really a runtime, not design time tool and I prefer not to use 
> it when 4D has all these design-time specific options that are native. [...]

Hi Peter,
much later… 

Just to mention that yesterday I had to add a bunch of tables (~50) and fields 
to an existing DB. I used SQL from spreadsheet definitions(save as cvs, read 
it, etc.) 

If one doesn't mind table positioning (*) and color in the structure editor, I 
found it very easy. Add table or field if it doesn't exist/modify else, delete 
errors, add "basic fields" (primary and foreign keys, for example), the 
TRAILING option… Worked great for me, I never added so much things in such a 
short time. I'm less happy with forms now  :-/

(*) 4D puts new tables "where there is place" from the top left corner, as I 
could see looking at the structure in 15% zoom and executing step by step. 

-- 
Arnaud de Montard 


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Peter Jakobsson
On 12 Oct 2016, at 14:13, Arnaud de Montard  wrote:

> I seem to remember I saw that when some tables had comments - but far, far 
> ago!

Ok, thanks. I’ll check.

Peter

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Arnaud de Montard

> Le 12 oct. 2016 à 13:10, Peter Jakobsson  a écrit :
> 
> [...] I always get an error message at the end, saying something like 
> “incompatible definition” [...]

I seem to remember I saw that when some tables had comments - but far, far ago!

-- 
Arnaud de Montard


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Peter Jakobsson
On 12 Oct 2016, at 12:57, Arnaud de Montard  wrote:

> But, unless I'm wrong, about relations in a copy/paste process, they are in 
> the copy but ignored by paste (tried v14 R5 and compared export as xml data 
> vs copy items in structure). 


Hi Arnaud

Yes, thats what I found also.

The IMPORT STRUCTURE command that Miyako recommended is great - it does the 
whole lot with high fidelity. Even gets the table colours right. The only 
problem I had is that I always get an error message at the end, saying 
something like “incompatible definition”, even though it seems to import 
everything perfectly. I didn’t investigate further but I’m going to use that 
option later so will return to it.

To me, SQL is really a runtime, not design time tool and I prefer not to use it 
when 4D has all these design-time specific options that are native. For 
example, one huge benefit of the pasteboard approach is that you can start a 
table off with a few basic fields. Then organise another 100 or so fields in a 
spreadsheet, evolving the names, fieldgroups and types till it’s perfect, then 
just paste them straight into the table (after parsing the pasteboard contents 
with the XML conversion). That is an extremely powerful design technique for 
front-loading a lot of the structure and business logic thinking into the 
analysis phase IMO.

Regards

Peter
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Arnaud de Montard

> Le 12 oct. 2016 à 12:22, Peter Jakobsson  a écrit :
> 
> Yes - SQL could have been possible. I don’t like using SQL for making 
> permanent structure changes though, ever since I noticed that relations made 
> with SQL are somehow “different” from ones made in the structure editor. I 
> think the XML is more native to 4D.

Tables and fields are ok but IMHO don't use SQL to create relations. Not only a 
matter of look (square at each end instead of arrow), it leads to worrying 
error messages if you try to modify such relations after. 

But, unless I'm wrong, about relations in a copy/paste process, they are in the 
copy but ignored by paste (tried v14 R5 and compared export as xml data vs copy 
items in structure). 

-- 
Arnaud de Montard 



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Peter Jakobsson
Miyako -

On 12 Oct 2016, at 02:28, Keisuke Miyako  wrote:

> you can add tables and fields via the clipboard or the new IMPORT STRUCTURE 
> command.


Your answer gave me the confidence to go back and look harder at the solution. 
Turns out 4D had a problem with the formatting in the document header: . I had version=“1” instead of version=“1.0” 
and that was enough to break it.

Another thing - I couldn’t find any documentation at all for the “type” 
attribute (which doesn’t correspond to 4D’s data type constants). Even the DTD 
doesn’t decode them so I just copied each field type in turn and inspected 4D’s 
XML dump to build a mapping table. (Listed below in case they’re useful to 
anyone else).

Everything works great now and I can lift a structure definition straight from 
a spreadsheet data dictionary, paste into an empty table and **kerboom**. Table 
implemented !


On 12 Oct 2016, at 11:44, Arnaud de Montard  wrote:

> Why not SQL instead?


Yes - SQL could have been possible. I don’t like using SQL for making permanent 
structure changes though, ever since I noticed that relations made with SQL are 
somehow “different” from ones made in the structure editor. I think the XML is 
more native to 4D.

Thanks for the responses !

Peter



4D Structure definition type mappings:

Alpha   10 (With “limiting_length” attribute)
Text10 (Without “limiting_length attribute)
Date8
Time9
Boolean 1
Integer 3
Longint 4
Integer 64 Bit  5
Real6
Float   7
Blob18
Picture 12
Object  21
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-12 Thread Arnaud de Montard

> Le 12 oct. 2016 à 00:51, Peter Jakobsson  a écrit :
> 
> Hi
> 
> I tried to write some code to convert 2 columns of data dictionary 
> (“Fieldname” “Fieldtype” definitions) from iWork’s “Numbers” spreadsheet 
> straight to a 4D structure but unfortunately it doesn’t work.[...]
> 
> Is anybody doing this type of thing already that would care to share some 
> tips ?

Why not SQL instead?

-- 
Arnaud de Montard 



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Data Dictionary to Structure via XML ?

2016-10-11 Thread Keisuke Miyako
there is really nothing special about the UUID,
you can add tables and fields via the clipboard or the new IMPORT STRUCTURE 
command.

it's actually better to use the command, not the pasteboard,
because that way you can define relations and index settings too.

either way, a new UUID is generated for new tables and fields,
whatever value you put in the pasteboard is ignored.

the UUID only matters when you also add relations or indexes.

> 2016/10/12 7:51、Peter Jakobsson  のメール:
> Is anybody doing this type of thing already that would care to share some 
> tips ?



宮古 啓介
セールス・エンジニア

株式会社フォーディー・ジャパン
〒150-0043
東京都渋谷区道玄坂1-10-2 渋谷THビル6F
Tel: 03-6427-8441
Fax: 03-6427-8449

keisuke.miy...@4d.com
www.4D.com/JP

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**