Randy:

Thanks so much for this. Giving me two ways - 4D and SQL. I am going to work on 
some code and interface for doing this.

Jody

> On Jun 22, 2018, at 12:09 PM, Randy Engle via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Jody,
> 
> You can set/create an index in 4D Code
> 
>               ARRAY POINTER($fieldPtrArr;1)
>               $fieldPtrArr{1}:=->[Facility]Facility_Name
>               CREATE INDEX([Facility];$fieldPtrArr;Standard BTree 
> index;"FacilityNameIDX")
>               
>                 // composite index
>               ARRAY POINTER($fieldPtrArr;2)
>               $fieldPtrArr{1}:=->[Facility]Service_Address_City
>               $fieldPtrArr{2}:=->[Facility]Service_Address_Zip_Code
>               CREATE INDEX([Facility];$fieldPtrArr;Standard BTree 
> index;"CityZipIDX")
> 
> 
> Primary Keys - Needs SQL
> 
> $sql:="ALTER TABLE "+$tableName
> $sql:=$sql+" "+"ADD PRIMARY KEY ("+$fieldName+")"
> Begin SQL
>       EXECUTE IMMEDIATE: $sql;
> End SQL
> 
> 
> 
> Randy Engle, Director
> XC2 Software LLC – XC2LIVE!
> 
> -----Original Message-----
> From: 4D_Tech <4d_tech-boun...@lists.4d.com 
> <mailto:4d_tech-boun...@lists.4d.com>> On Behalf Of Jody Bevan via 4D_Tech
> Sent: Friday, June 22, 2018 10:45 AM
> To: 4D iNug Technical <4d_tech@lists.4d.com <mailto:4d_tech@lists.4d.com>>
> Cc: Jody Bevan <jody.be...@gmail.com <mailto:jody.be...@gmail.com>>
> Subject: Creating Tables by running a method
> 
> I know that this feature has been around for a long time  ~ 4D 2011.
> 
> I am now using 16R6. I now have a method that creates a table with the fields 
> I want added.
> 
> The challenge I am having is setting indexes (and index types), as well as 
> Primary Keys. 
> 
> I looked in the Knowledge Base for code examples but do not see any - hmmm.
> 
> I am not a SQL person, so reading the 4D SQL Reference on this is a bigger 
> challenge to me.
> 
> Can anyone pass along a point to example code, or reference for this.
> 
> Thanks
> 
> 
> 
> 
> Jody Bevan
> Developer
> 
> Argus Productions Inc. <https://www.facebook.com/ArgusProductions/ 
> <https://www.facebook.com/ArgusProductions/>>
> +1 587-487-6120
> 

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

Reply via email to