Thank you 

We used to use 4D very heavily but that no longer the case and are exporting 
data out to SQL :(

So a huge thanks for this 

Regards

Tony

-----Original Message-----
From: 4D_Tech [mailto:[email protected]] On Behalf Of Peter Bozek 
via 4D_Tech
Sent: 04 September 2019 14:18
To: 4D iNug Technical
Cc: Peter Bozek
Subject: Re: 4D 2003 export structure

This is method I used in older version of 4D, not sure if it will work in
4D 2003 but it should:

  // ==========================
//exporting procedure for structure

C_TIME($refNum)
C_STRING(3;$cr;$tb)
C_STRING(31;$s)
C_LONGINT($table;$field;$len;$type;$ot;$of;$cf)
C_BOOLEAN($invisible;$trig1;$trig2;$trig3;$trig4;$ind;$uni;$inv;$ao;$am)

$cr:=Char(Carriage return)
$tb:=Char(Tab)

$refNum:=Create document("";"TEXT")
If (OK=1)
For ($table;1;Get last table number)
  //export table info
SEND PACKET($refNum;Table name($table)+$tb)

GET TABLE PROPERTIES($table;$inv;$trig1;$trig2;$trig3;$trig4)
If ($inv)
SEND PACKET($refNum;"I"+$tb)
End if
If ($trig1)
SEND PACKET($refNum;"N")
End if
If ($trig2)
SEND PACKET($refNum;"S")
End if
If ($trig3)
SEND PACKET($refNum;"D")
End if
If ($trig4)
SEND PACKET($refNum;"L")
End if


SEND PACKET($refNum;$cr+$cr)

For ($field;1;Get last field number($table))
SEND PACKET($refNum;Field name($table;$field)+$tb)
GET FIELD PROPERTIES($table;$field;$type;$len;$ind;$uni;$inv)
Case of
: ($type=Is Alpha Field)
$s:="S"+String($len)
: ($type=Is Real)
$s:="R"
: ($type=Is Text)
$s:="T"
: ($type=Is Picture)
$s:="P"
: ($type=Is LongInt)
$s:="L"
: ($type=Is BLOB)
$s:="O"
: ($type=Is Boolean)
$s:="B"
: ($type=Is Date)
$s:="D"
: ($type=Is Time)
$s:="T"
: ($type=Is Subtable)
$s:="X"

End case
SEND PACKET($refNum;$s+$tb)

If ($ind)
SEND PACKET($refNum;"I")
End if
If ($uni)
SEND PACKET($refNum;"U")
End if
If ($inv)
SEND PACKET($refNum;"N")
End if

SEND PACKET($refNum;$tb)


GET RELATION PROPERTIES($table;$field;$ot;$of;$cf;$ao;$am)

If ($ot#0)
SEND PACKET($refNum;"->")
SEND PACKET($refNum;Field name($ot;$of)+$tb)

If ($ao)
SEND PACKET($refNum;"O")
End if
If ($am)
SEND PACKET($refNum;"M")
End if


End if

SEND PACKET($refNum;$cr)

End for
SEND PACKET($refNum;$cr+$cr)

End for
CLOSE DOCUMENT($refNum)
End if

// ==========================

Regards,

Peter Bozek

On Wed, Sep 4, 2019 at 2:20 PM Narinder Chandi via 4D_Tech <
[email protected]> wrote:

> Tony,
>
> Are you able to open the structure with a later version of 4D? In v14 the
> EXPORT STRUCTURE command was introduced:
> https://doc.4d.com/4Dv17/4D/17.2/EXPORT-STRUCTURE.301-4386049.en.html
> which would get you the quickest representation of your structure, albeit
> in XML.
>
> Otherwise it should only take a few minutes to crank out a custom method
> to produce an text output representation of your structure using the
> structure access commands:
> https://doc.4d.com/4Dv17/4D/17.2/Structure-Access.201-4385958.en.html
>
> Unfortunately I don't have such method to hand though.
>
> Regards,
>
> Narinder Chandi,
> ToolBox Systems Ltd.
> --
>
> -----Original Message-----
> From: 4D_Tech <[email protected]> on behalf of 4D Tech Mailing
> List <[email protected]>
> Reply-To: 4D Tech Mailing List <[email protected]>
> Date: Wednesday, 4 September 2019 at 13:04
> To: 4D Tech Mailing List <[email protected]>
> Cc: "Wright, Tony" <[email protected]>
> Subject: 4D 2003  export structure
>
>     Hi
>
>     Does anyone have a method I can use to create a text file
>     With information of each table and info about each attubute
>
>     i.e.
>
>     Table name = patients
>     Fields
>         Surname Alpha 30
>         Forename alpha 30
>         DOB = Date
>
>         Etc etc
>
>     This DB was using 4D 2003 in its days
>
>     Many thanks
>
>     Tony
>
>
>
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

*****************************************************************
The information contained in this message may be confidential or 
legally privileged and is intended for the addressee only. If you 
have received this message in error or there are any problems 
please notify the originator immediately. The unauthorised use, 
disclosure, copying or alteration of this message is 
strictly forbidden.
*****************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to