Jody, Glad to hear of your progress!
Randy Engle, Director XC2 Software LLC – XC2LIVE! -----Original Message----- From: 4D_Tech <4d_tech-boun...@lists.4d.com> On Behalf Of Jody Bevan via 4D_Tech Sent: Saturday, June 23, 2018 9:53 AM To: 4D iNug Technical <4d_tech@lists.4d.com> Cc: Jody Bevan <jody.be...@gmail.com> Subject: Re: Creating Tables by running a method Randy: So I have got this done using all SQL. At the end it would create the indexes for the first table I created, but then fail for al the next. Eventually I figured out that the index name (behind the scenes) need to be unique within the whole database. Therefore I just added a string of the table number into the middle of the Index name. Tried it at front and that failed. All these little gotchas. I really didn’t want to sit and read SQL books for a week that may or may not explain these issues. Thanks for your help - it is working!! Pat: I am using 16R6. I tried creating a trigger in the tables that I created using SQL. I can go in and write code in the table triggers. They are saved. I didn’t see if they actually ran though. Maybe 4D resolved this issue. Thanks all Now on to having the method write all our standard code around a table that our shell has. Jody Bevan Developer Argus Productions Inc. <https://www.facebook.com/ArgusProductions/> +1 587-487-6120 > On Jun 22, 2018, at 3:18 PM, Jody Bevan <jody.be...@gmail.com> wrote: > > 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 >> <mailto: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! >> > ********************************************************************** 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 ********************************************************************** ********************************************************************** 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 **********************************************************************