Re: Foreign Key Constraint

2001-06-20 Thread Erik Carroll

This will work, just make sure that you insert the record into
tblAppointment_2 before updating the tblAppointment_1 to
avoid a constraint violation.

One thing to consider is the type of relationship between the two tables.
The way you are setting it up now is each tblAppointment_1 record
can be linked to only one tblAppointment_2 record, but each
tblAppointment_2 can be linked to many tblAppointment_1 records.

If this suits your needs then fine.

Not seeing tha data or knowing the requirements its hard to be sure, but you
might
consider putting the foreign key on tblAppointment_2 and have it reference
DEcisionID on tblAppointment_1. This would allow the ONE to MANY
relationship
that I think you are trying to establish.

Again, this is just a best guess from looking at your table structure. If
you are
establishing only a ONE to ONE relationship then what you are thinking of
will work just fine.


Erik


- Original Message -
From: Julie Clegg [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Monday, June 18, 2001 12:02 PM
Subject: Foreign Key Constraint





 I have 2 tables - tblAppointment_1 and tblAppointment_2.  I want to set up
a
 foreign key in appointment_1 to connect it to Appointment_2.  My question
 is, if the Appointment_1 record is created a few weeks before
Appointment_2,
 will this be a problem because the foreign key will be null for a period
of
 time?  ie...appt_1 record is created first.  Then, after some time, Appt_2
 record is created and appt_1 record is updated(inserting the CASACID).

 Appt_1 Appt_2
 
 DEcisionID(PrimaryKey)CasacID(PrimaryKey)
 date  date
 firstname outcome
 lastname
 CASACID(ForeighKey)

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Show Duplicates

2001-06-05 Thread Erik Carroll

This accomplishes the same thing but is a little easier on the eyes:

SELECT Field1, COUNT(*) AS Total
FROM has_duplicates
GROUP BY Field1
ORDER BY Field1


Sample table data and output below, I think this is what you were looking
for.

ID Field1 Field2
1   Test1   1
2   Test1   6
3   Test1   1
4   Test2   0
5   Test2   9
6   Test4   1
7   Test4   8
8   Test4   7
9   Test4   3
10 Test8   0

Field1 Total
Test13
Test22
Test44
Test81


Erik



- Original Message -
From: Joseph Thompson [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 05, 2001 2:03 AM
Subject: Re: Show Duplicates


 Hunted down, found and installed the query analyzer...

 It looks odd but it works, Thank you!

 cfquery datasource=cfhub name=test
 SELECT [Field1], [ID]
 FROM has_duplicates
 WHERE [Field1] In (SELECT [Field1] FROM [has_duplicates] As Tmp GROUP BY
 [Field1] HAVING Count(*)1 )
 ORDER BY [Field1];
 /cfquery


 
  There is a Find Duplicates Query wizard in Access
  In Query, New
 
  just put the SQL inside a cfquery tag
 
  Seamus
 
 
  At 02:32 pm 5/06/01 , you wrote:
  There must be a way to display a list of duplicates from an Access
table.
  (going a little batty)
  
  Say I want to display:
  test1 -- 3 occurences
  test2 -- 2 ocurences
  
  TableName: has_duplicates
  Fields:
  
  ID Field1 Field2
  1   test1 1
  2   test2 2
  3   test3 3
  4   test1 4
  5   test2 5
  6   test3 6
  7   test1 1
  
  
  (Not important but... I was a little disturbed that I couldn't figure
 it
  out)
  
  Thanks for any help :)
  
  
  
  
  
 

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: syntax error when inserting date

2001-05-09 Thread Erik Carroll

What database are you using? The problem may be that your database is
expecting the date in a specific format. Using Oracle as an example, the
value you are trying to insert into the Date column, '#onedate#', would be
seen as a string and not a date which would generate an error. Oracle has a
TO_DATE function that will convert the string to a date format. Check to
make sure the format is recognizable by the database you are using and also
check if the date string needs to be converted before inserting.

Erik

- Original Message -
From: megan sherman [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, May 09, 2001 10:01 AM
Subject: syntax error when inserting date


 Hi all,
 My action template is supposed to insert classID, location and date into
 a table in my database. When creating new records in the form I provide,
 I want the user to be able to supply a comma delimited list of dates. I
 think the loop in the action template successfully extracts individual
 dates from the date list, but there is a syntax error in the insert
 command. Everything works if I don't try to insert the date, so that
 must be where the syntax error occurs. Can anybody tell me what my date
 syntax error is?
 Thanks in advance!
 Megan
 The action template code is shown below
 CFIF IsDefined(FORM.scheduleID)
  CFUPDATE DATASOURCE=calkayak TABLENAME=class_schedule
 CFELSE
 cfoutput
 cfset dategroup=form.date
 cfloop index=x from=1 to=#ListLen(dategroup)#
 cfset onedate=ListGetAt(dategroup,#x#)
 cfquery datasource=calkayak
 insert into class_schedule (classID, location, date)
 values(#form.classID#, '#form.location#', '#onedate#')
 /cfquery
 /cfloop
 /cfoutput
 /CFIF


 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: One form, two submit buttons...

2001-05-04 Thread Erik Carroll

In addition to the ways already presented you can try something like this

Put however many buttons you want on the form. Give them the same name but
different values.
Imagine a form with two input boxes for two numbers and  four buttons as
follows.

   INPUT TYPE=Submit NAME=Submit VALUE=Add
   INPUT TYPE=Submit NAME=Submit VALUE=Subtract
   INPUT TYPE=Submit NAME=Submit VALUE=Multiply
   INPUT TYPE=Submit NAME=Submit VALUE=Divide

When the form is submitted, you can interrogate form.submit as follows to
determine which button was pressed.

   CFSWITCH EXPRESSION=#form.submit#
   CFCASE VALUE=Add
   CFINCLUDE TEMPLATE=actions/act_addnumbers.cfm
   /CFCASE
   CFCASE VALUE=Subtract
   CFINCLUDE TEMPLATE=actions/act_subtractnumbers.cfm
   /CFCASE
   CFCASE VALUE=Multiply
   CFINCLUDE TEMPLATE=actions/act_multiplynumbers.cfm
   /CFCASE
   CFCASE VALUE=Divide
   CFINCLUDE TEMPLATE=actions/act_dividenumbers.cfm
   /CFCASE
/CFSWITCH

Erik


- Original Message -
From: W Luke [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Sunday, April 29, 2001 1:07 PM
Subject: One form, two submit buttons...


 Hi,

 I have a form that is posted to a processing page.  I want to add another
 button that submits the form information to another page, if the user
 wishes, which will preview what it will look like.

 How can I do this?

 Cheers.

 --
 Will
 Free Classifieds -=- www.localbounty.com
 e: [EMAIL PROTECTED]  icq: 31099745





~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists