Checkbox State Help
Try to get the checkbox state into a var from an if Flash CS3
AS2.0
When I press a button I have set up to email I cannot seem to
get the state of the checkbox working.
I can get a value but is always the same weather ticked or
not. below code always returns no
Please can anyone help
on (release) {
if (this.RSVP_text_popup.Check_box.selected) {
var Coming = "Yes";
} else {
var Coming = "No";
var subject = "Wedding Invite "+GuestsNames.text+" "+Coming;
var body =
_root.RSVP_text_popup.RSVP_bodycopy.body_Text.text;
getURL("mailto:[email protected]"+"?subject="+subject+"&body="+body);
}
use trace(this.RSVP_text_popup.Check_box) to confirm the
problem is an incorrect path/name issue.
Similar Messages
-
Saving checkbox-state to table in Interactive Report
Hi,
I have been working with the information on http://www.apexninjas.com/blog/wp-content/uploads/2012/03/Checkboxes_in_Interactive_Reports.pdf to create an interactive report with a column containing a checkbox for each row.
My report contains the following (simplified):
Task_id, Employee_id, Checkbox_column
The checkbox_column keeps track of which employees work on which tasks, so it could be:
Task_id, Employee_id, Checkbox_column
1 1 0
1 2 1
1 3 0
signifying that only employee 2 works on task 1.
Now, I need to be able to change the 0 to 1 by clicking the checkbox, which already is possible, but I have problems saving that row to the database. Saving the checkbox state is also included in the PDF I used (page 12-14, 'Saving the checkbox state #2'), but I don't really understand where to put the scripts, I haven't worked with scripts and processes before so I could use some help understanding which script I need to put where. All in all, it's not too much code, I just don't understand where to put it.
The scripts mentioned in the PDF are:
The first one is a SQL-statement or a package, I imported the package in my environment, so I won't put the SQL here
This is the only one I know where to put:
<script type="text/javascript">
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
</script>
This I don't know where to put:
<script type="text/javascript">
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
</script>
the PDF says:
Now, create a hidden (just hidden, not protected!) item called P_IR_REPORT_ ID inside a HTML region.
Important! This region has to be rendered afterthe Interactive Report, so create it in the “after footer” display point!
In this regions’s footer paste the following JavaScript code, that will assign the hidden item P_IR_REPORT_ID the value of the Interactive Report ID.
But can we create a region in the after footer?
This I don't know where to put because the document doesn't specify it:
apex_ir_query.ir_query_where
(:APP_ID,--application id
99,--page id
:SESSION,--sesion ID
: P_IR_REPORT_ID -–interactive report ID);
This I don't know where to put, but I guess it's a 'processing' process:
declare
whereStmt varchar2(2000);
sqlStmt varchar2(2000);
begin
whereStmt := apex_ir_query.ir_query_where(:APP_ID,
99,
:SESSION,
:P_IR_REPORT_ID);
sqlStmt := 'update CHK_TEST set SELECTED = 0 where SELECTED= 1'||whereStmt;
execute immediate sqlStmt;
if APEX_APPLICATION.G_F01.COUNT>0 then
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
update CHK_TEST
set VALID_LINE = 1
where SELECTED_ID = APEX_APPLICATION.G_F01(i)
and VALID_LINE = 0;
END LOOP;
end if;
end;
Can I please get some help understanding where exactly to put these scripts?
I've been looking around on the forum and Google but I can't find the detailed answer to what I'm looking for anywhere.
I am currently working with the test environment Oracle supplied us, because we are testing if we can use APEX at our company.
The version is Application Express 4.2.2.00.11 and it's running on Oracle 11g.
Just ask if you need any more info.
Thanks for the answers!
NDGPlease put together an example application on apex.oracle.com and provide developer credentials. This would help prevent multiple posts back and forth about try this, try that, now try this, now try that......
But until you do that try this:
I think you already know that the following goes in the page html header.
<script type="text/javascript">
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
</script>
Alternately, since you are on apex 4.2 you could just add it to the Page Attributes->JavaScript->Function and Global Variable Declaration field (without the script tags):
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
Now you need to create an HTML region (in display point "after footer"). Then you create the P_IR_REPORT_ID hidden item inside your new region.
In the region definition you will put the following code into the region footer:
<script type="text/javascript">
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
</script>
Alternately, you could try to add the line to the Page Attributes->JavaScript->Execute when Page Loads field:
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
This is just an example of the procedure call you will make in your page process.
apex_ir_query.ir_query_where
(:APP_ID,--application id
99,--page id
:SESSION,--sesion ID
: P_IR_REPORT_ID -–interactive report ID);
It is included in this code which you will put into a page process.
declare
whereStmt varchar2(2000);
sqlStmt varchar2(2000);
begin
whereStmt := apex_ir_query.ir_query_where(:APP_ID,
99,
:SESSION,
:P_IR_REPORT_ID);
sqlStmt := 'update CHK_TEST set SELECTED = 0 where SELECTED= 1'||whereStmt;
execute immediate sqlStmt;
if APEX_APPLICATION.G_F01.COUNT>0 then
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
update CHK_TEST
set VALID_LINE = 1
where SELECTED_ID = APEX_APPLICATION.G_F01(i)
and VALID_LINE = 0;
END LOOP;
end if;
end;
Ok, clear as mud! -
Unexpected behavior of checkbox with help text
Hi everyone.
I'm using a checkbox to achieve a yes/no user input and I've noticed something strange. Whenever the user clicks on the help text (label) associated with the checkbox, the help text pops up and the checkbox changes state.
For example, if the checkbox is unchecked, if the user clicks on the label / help text, when they close the popup, the box is checked.
It's not the end of the world or anything, but could be confusing for end users and so is undesirable. Is this a known issue? Maybe something that could be changed in a future release?
regards,
KieranChange this -
<div id="Layer1" style="position:absolute; width:296px;
to this -
<div id="Layer1" style="position:relative; width:296px;
and reposition the div.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"kc41082" <[email protected]> wrote in
message
news:ebi7s4$5bp$[email protected]..
> Can somebody please help me? I would appreciate it more
than you know. I
> am not
> all that good at writing code -- in fact, I know very
little about it.
> However,
> I love to design. Therefore, I periodically build
websites for small
> businesses
> pro bono.
>
> I built a site in Dreaamweaver using table cells. In one
of my table
> cells, I
> would like scrolling text. However, I do not want the
text to fill up the
> entire cell (margins on each side of text so it does not
extend to edges
> of
> table cell). To do this, I inserted a layer and set it
on top of the table
> cell, where I want the text. I told it to scroll when
the text overflows.
> However, although it looks fine on screen, the text
moves over to the left
> when
> I load it in my browser. I cannot figure it out!!! I
want to change it
> (maybe)
> RELATIVE (instead of absolute) to my table cell, but
can't get that to
> work. I
> have seen the code you have suggested to people , but
don't understand
> where to
> insert the code into my website.
>
> Will somebody check it out for me and offer me a
suggestion? It can't be
> too
> difficult to fix. Please visit kaycee.mutpup.com and
click on the link
> provided. It will take you to the temporary site I have
posted.
>
> THANK YOU!
> -
Hi Everyone,
I'm sure I'm doing something really dumb here but I cannot
get my checkbox state to show as true when making a call from my
Access database. The checkbox just displays unticked. The code I am
using is:
<input <%If
(CStr((rsEditProfile.Fields.Item("approvedSupplier").Value)) =
CStr("true")) Then Response.Write("checked=""checked""") :
Response.Write("")%> name="approvedSupplier" type="checkbox"
id="approvedSupplier">
The databse record is selected and so is true but the
checkbox doesn't diplay ticked. Any help please appreciated.
Ta Jules xI found a page that I did and copied the code and replaced
with your values,
the values are in a different order...who knows. I also
noticed your
response.write had some extra "
<input <%If
(CStr((rsEditProfile.Fields.Item("approvedSupplier").Value)) =
CStr("TRUE")) Then Response.Write("checked") :
Response.Write("")%>
name="approvedSupplier type="checkbox" id="approvedSupplier"
value="TRUE">
"Julesmg" <[email protected]> wrote in
message
news:f4ufnm$5ab$[email protected]..
> Thanks for the suggestion, but it makes no difference.
The feild updates
> OK
> when I submit a ticked checkbox but just will not show
as ticked on the
> resulting page. ASP is now:
>
> <input name="approvedSupplier" type="checkbox"
id="approvedSupplier"
> value="TRUE" <%If
>
(CStr((rsEditProfile.Fields.Item("approvedSupplier").Value))
> = CStr("TRUE")) Then
Response.Write("checked=""checked""") :
> Response.Write("")%>>
>
> It's got me stumped!!!
> -
Passing Multiple Checkbox Values Help
Brand new to Coldfusion and I'm struggling to figure out how to pass values from multiple checkboxes on a form to a confirmation page and then an action page that inserts the data. The confirmation page will simply show their selections and allow them to go back and reselect, or submit to the action page.
Form > Confirmation Page > Action
I've found a couple of examples on the Web that mention looping, and one that said to use a WHERE IN clause but I'm lost on how to pass it through and insert at the end. Maybe the confirmation and action can be on the same page?
Questions:
1. Is it better to name all of the checkbox values the same or append some type of extra character and then evaluate at the end?
2. Do I need to have hidden fields on the confirm page to transfer the data inbetween the form and action page?
3. Can the confirmation and action be on the same page or should they be separated?
4. What should the Query/Insert statement look like on the action page?
I'm looking to see a basic example of code from start to finish, any help is greatly appreciated as I'm in learning mode.
Thankskittlez wrote:
Ok so I know how to pass everything to the second page. I'm guessing I need hidden fields on that second page to go through to the last page where I insert the records...correct?
That is one way to do it. But one might also want to look into session variables if they have not been considered.
When I've tried to do this I end up with something like this item1,item2,item3 all together which the database will not accept. How do I write the multiple values to the database so they are considered to be separate records.
item1,item2,item3 is what you are supposed to get according to the HTTP protocol standard. To insert that into a database you just need to recognize that you are getting a list and use ColdFusions list handling functions and tags to help you iterate through the list and do what you need to do with the data.
This is a very hand code snippet for this type of work:
<cfloop list="#listVariable#" index="aVar">
#aVar# will equal one list item.
</cfloop> -
Problem with a checkbox -pls help
I have a tabular form with checkbox for all rows and I want to update all the rows where checkbox is checked .
select
APEX_ITEM.CHECKBOX(1,ID) as " ",
"ID",
"ID" ID_DISPLAY,
other records ...
from
below the code
declare
vROW number;
begin
if :REQUEST = 'SUBMIT' then
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
vROW := TO_NUMBER(APEX_APPLICATION.G_F01(i));
update table ... where id = vROW
END LOOP;
end if;
end;
when testing I observed that vROW has ID value even I did not tick any checkbox .
How can I check if checkbox is ticked in this case ???
thanks
solo"In order to do that, you don't need to use a checkbox. Building a tabular form on your table, using APEX wizard, will give you an updatable form, in which you can update any of the displaying cells, and submitting the form will update them automatically. The standard tabular form uses the checkboxes only for deleting records."
I'm affraid it is not possible. I have a complex view and I need a PL/SQL code to update the modified rows in another table ..
"If you want to construct your tabular form yourself, and use checkboxes as part of a self-developed update process, you should use the "SQL Query (updatable report)" for your report type. This type of report allows you to use a built-in component called "Row Selector" – in the tasks box of the report attribute tab. This is a built-in checkbox component, which the report generator can use with your other report component, and synchronize all of them with the APEX_APPLICATION.G_F arrays, in order to avoid the problem Scott pointed out to you. "
It's incredible .
When I do Page->Tabular Form->Query ( update only ) the checkbox does not appear .
IF I do Page->Tabular Form->Query ( update/insert/delete ) the checkbox the checkbox appear .
... I spend a lot of time becuase of this ...... ( I don't want to say )
Now , my tabular form has 67 columns .. how can I manage all this columns values ( if remember well ..limit is 50 ) . Any , tricks ???
what's wrong with this code ?
declare
v number;
pk varchar2(50);
c1 varchar2(50);
c2 varchar2(50);
c9 varchar2(50);
begin
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
v := to_number(APEX_APPLICATION.G_F01(i));
pk := APEX_APPLICATION.G_F02(v);
c1 := APEX_APPLICATION.G_F03(v);
c9 := APEX_APPLICATION.G_F04(v);
insert into test_1 values ( pk );
insert into test_1 values ( c1 );
insert into test_1 values ( c2 );
insert into test_1 values ( c9 );
END LOOP;
end;
I expected to have value of field 2 , field 3 , filed 4 , of the checked row .. but it's working .
PS: I want to thank everybody who help me until now !
solo -
If/then checkbox script help in Adobe Acrobat Form...
If have an order form that has two different pricing fields (regular price per item & subscription price per item) for each line item and then a quantity and then a total field. Lastly, there is a checkbox on the form that indicate if they are signing up for a monthly subscription.
What I am trying to do is create a script that totals each line by the regular price multipled by the quantity or subscription price by quantity if the subscription check box is checked ("Yes"). So far, I've tried several scripts I found in the forum but no luck at all.
The check box is near the billing fields toward the bottom so all the line items appear first in the top section of the form. So, an individual would fill out each line and the calculations would just total each row (reg price * qty) as you go down the form...then when you check the subscription box all the line totals would change to reflect the subscription pricing for each row (which can be different). Just need help with one row and I can duplicate for each row.....
Here is what I have that does NOT work yet.....:
(function () {
if (this.getField("sub").value==="Yes") {
var b1 = this.getField("Price1b");
var c1 = this.getField("Qty1");
var d1 = this.getField("Price1");
event.value = b1.value * c1.value;
} else event.value = d1.value * c1.value;One last strange thing is that when I then do the "Value is the Sum simple total of the row total fields (where the script is) and then click the check mark for subscription, the number in the grand total field shows the opposite value as the row total field (so when you click the subscription check box, the row total goes to the subscription price and the grand total field then shows the full price)....can't figure out why that happens......?
Any ideas? -
Prepared Statement help -- cant get it to work :(
Context initialcontext = new InitialContext();
DataSource datasource = (DataSource)initialcontext.lookup("java:comp/env/XYZ");
Connection conn = datasource.getConnection();
String UPDATE = "update query with ?s ";
PreparedStatement pstmt = conn.prepareStatement(UPDATE);
pstmt.setString(1,title);
pstmt.setString(2,desc);
pstmt.setInt(3,1);
System.out.println("2a");
pstmt.executeQuery(); ------- STUCK HERE
System.out.println("2b");
pstmt.close();
It goes between 2a and 2b and just stops working.. no errors nothing...
I have been trying to get this working the entire day... with no luck... any suggestions........I am familiar with a few dialects of SQL. I've never seen
UPDATE <tbl> WITH...
What RDBMS are you using? I just searched the mySQL documentation on the keyword WITH (case sensitive) and found no form of update that uses it.
The ANSI SQL UPDATE statement takes the form...
UPDATE <tbl> SET <col> = <value>[, <col> = <value>...]
Also, you have three calls to setString, but only one ? in your String UPDATE indicating a position for a parameter.
http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
Hope this helps. If there is a form of UPDATE that uses WITH, please provide me with a reference link. I'm supposed to know SQL. :-) -
Prepared statement help... pls...
hey all... need help... this prepared statement is driving me mad... keeps throwing an error in my servlet.... can somebody pls help
PreparedStatement updateWiki = con.prepareStatement("UPDATE sportinfo SET pageinfo,parent = (?,?) WHERE sport LIKE ? ");
updateWiki.setString(1, wikipage);
updateWiki.setString(2, parent);
updateWiki.setString(3, sport);
updateWiki.executeUpdate();
am i missing something???
thanks keith1. What is the error? Please post it.
2. Try using the query like:
UPDATE sportinfo SET pageinfo=?,parent=? WHERE sport LIKE ?
and see if it still fails. -
here is a sample code of my application....
int initialDelay = 10000; // start after 10 second
int period = 10000*60*60*24*30; // repeat every month
Timer timer = new Timer();
TimerTask task = new TimerTask() {
public void run() {
try {
MyDBConnection jdbc = new MyDBConnection();
jdbc.init();
Connection conn = jdbc.getMyConnection();
Statement stmt = conn.createStatement();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String[] tbl = {"emticket","emattachment","emhistory","emtracker"};
progTxt.setText("");
Logs l = new Logs();
l.append("Auto Archive");
date.getTime();
//Archive data
progTxt.append("\n\n");
progTxt.append(" Archiving Data...\n ");
stmt.execute("select * into outfile 'c:/emticket " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate()");
stmt.execute("select * into outfile 'c:/emattachment " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emattachment where EmID in (select EmID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
stmt.execute("select * into outfile 'c:/emhistory " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emhistory where TicketID in (select TicketID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
stmt.execute("select * into outfile 'c:/emtracker " + dateFormat.format(date) + ".csv' fields terminated by ',' enclosed by '\"' lines terminated by '\\n' from emtracker where TicketID in (select TicketID from emticket where RcvDateTime between date_sub(curdate(),interval 90 day) and curdate())");
progTxt.append("Done.\n\n");
//Delete data
progTxt.append(" Deleting Data... ");
stmt.execute("delete emticket, emattachment, emhistory, emtracker from emticket, emattachment, emhistory, emtracker where emattachment.EmID=emticket.EmID and emhistory.TicketID=emticket.TicketID and emtracker.TicketID=emtracker.TicketID and where RcvDateTime
"_______"DATE_SUB(CURDATE(),INTERVAL 90 DAY) and CURDATE())");
System.out.println(stmt.getUpdateCount());
progTxt.append("Done.\n\n");
Here's what i want to do....I want to backup file for the current date back to 3 mos...e.g 2007-05-23 down to 2007-02-23...then delete the remaining records...before"02-23-2007 to 05-23-2007"....this is where the query part i that doesn't work....
Delete data
progTxt.append(" Deleting Data... ");
stmt.execute("delete emticket, emattachment, emhistory, emtracker from emticket, emattachment, emhistory, emtracker where emattachment.EmID=emticket.EmID and emhistory.TicketID=emticket.TicketID and emtracker.TicketID=emtracker.TicketID and where RcvDateTime
"_______"DATE_SUB(CURDATE(),INTERVAL 90 DAY) and CURDATE())");
System.out.println(stmt.getUpdateCount());
progTxt.append("Done.\n\n")
I tried putting <>=which means not equal in the "_____"but it fails to work..can somebody help me to work out with this query.I don't know MySQL, but shouldn't you just use <= ? I also don't understand what the final part 'and CURDATE()' is for...
-
MySQL Select Statement Help Required
I am trying to generate a report in VS 2008 (C#) using a mysql select statement but cannot get it right.
I have groups that meet on a weekly basis on different days. I want to generate a report that shows me all the members that have not attended their group where they have missed 3 meetings in a row.
Below is the select statement I have tried but it does not give me the results I am looking for. I have tried to look at all the meetings in a 4 week period but would prefer to look at the last 3 meetings that are recorded. Some groups might not record a meeting every week. So I want to look at the last 3 recorded meetings and count each members attendance and only report on the members with more than 3 meetings missed.
SELECT COUNT(`groupattendance`.`Attended`) AS Attendance, `smallgroupform`.`MeetingDate`, `userinfo`.`FirstName`, `userinfo`.`Surname`, `smallgroup`.`GroupName`, `groupattendance`.`Attended`, `groupattendance`.`UserID`, `groupattendance`.`GroupID`
FROM ((`anatomy`.`groupattendance` `groupattendance`
INNER JOIN `anatomy`.`smallgroupform` `smallgroupform` ON `groupattendance`.`FormID` = `smallgroupform`.`FormID`)
INNER JOIN `anatomy`.`userinfo` `userinfo` ON `groupattendance`.`UserID` = `userinfo`.`UserID`)
INNER JOIN `anatomy`.`smallgroup` `smallgroup` ON `groupattendance`.`GroupID` = `smallgroup`.`GroupID`
WHERE (`smallgroupform`.`MeetingDate` >= DATE_SUB(CURDATE(),INTERVAL 4 WEEK) AND `smallgroupform`.`MeetingDate` <= CURDATE()) AND `groupattendance`.`Attended` = 'False'
GROUP BY `userinfo`.`UserID`
HAVING Attendance >= 3
Thanks,
Garth.Hi Garth,
Seems no one can help you directly. Try googling your SQL request. Someone may be able to help you. At this point its not really a Cr problem.
One option is to get all the data and add filtering using the record selection formula.
Thank you
Don -
Submit statement help - URGENT!!
Hi..
pls help me with this..
requirement is like this..
I am calling a report from another one. Say the calling report is first and the called is second. I am calling using submit statement.
populated data in an internal table in second report.
Returned to the first report and called third report and filled an internal table and came back to first report.
Is there anyway that I can get those two ITABS at a time in the first report. Because i got to compare them.
Pls suggest .. Thanks a lot!@!Hi,
Check this example..
*Send the internal table memory from the second report.
EXPORT ITAB2 TO MEMORY ID 'REPORT2'.
*Get the values from the second report.
IMPORT ITAB2 FROM MEMORY ID 'REPORT2'.
*Send the internal table memory from the third report.
EXPORT ITAB3 TO MEMORY ID 'REPORT3'.
*Get the values from the third report.
IMPORT ITAB3 FROM MEMORY ID 'REPORT3'.
Compare the internal table.
IF ITAB2[] = ITAB3[].
ENDIF.
Thanks,
Naren
Message was edited by: Narendran Muthukumaran -
Code too large for try statement - help :(
Please help :(
We are migrating our project from an older technology, Kiva from netscape
(and about time we migrate) . Kiva uses template evaluation similar to
jakarta velocity. So the fastest way we found was to translate kiva
templates to JSPs via perl script. All is working fine except a bunch of
JSPs which are too large for the compiler to handle. If we were not
migrating and instead wroking from scratch we would have simply made the
JSP's size smaller and used jsp:include, but in this case it will involve a
lot of effort as that means changing a lot of business code.
Basically what we get is "code too large for try statement". Is there anyway
we can tell weblogic to put smaller code fragments in try/catch when it
converts a JSP into java code.
Haider,
Have you seen the following Sun Bug Parade posting
http://developer.java.sun.com/developer/bugParade/bugs/4210912.html
Additionally, you may want to try the '-noTryBlocks' jsp compiler switch and see
if it makes a difference
See the following 6.1 URL
http://edocs.bea.com/wls/docs61/jsp/reference.html#57805
Chuck Nelson
DRE
BEA Technical Support
-
Oracle Spatial operator SQL statement help
I have a 3D elevation point feature class (elev) and a polygon feature class (Building) loaded in Oracle Spatial. I am trying to update the "HEIGHT" attribute of the "Building" Feature class using the average elevation of "elev" feature class. Here below is the SQL statement I used, which generated the same value for all buildings. The avg(elevation) returns the average elevation of all points within all building polygons, not all points within ONE polygon.
Please help and thanks.
update building
set height = (select avg(elevation)
from elev e, building b
where sdo_anyinteract(e.shape, b.shape) = 'TRUE');Hi,
try this
update building b
set height = (select avg(elevation)
from elev e where sdo_anyinteract(e.shape, b.shape) = 'TRUE');
Udo -
case
when datepart(mm,[SDate]) between '9' and '11' and datepart(mm,[PDate] ) between '9' and '11'
Then 'Q1_'
when datepart(mm,[SDate]) between '12' and '02' and datepart(mm,[PDate] ) between '12' and '02'
Then 'Q2_'
when datepart(mm,[SDate]) between '03' and '05' and datepart(mm,[PDate] ) between '03' and '05'
Then 'Q3_'
when datepart(mm,[SDate]) between '06' and '08' and datepart(mm,[PDate] ) between '06' and '08'
Then 'Q4_'
else 'N/A' end as QTR
from DDA_2015_FSR
Datatype for SDate and Pdate
2014-09-01 00:00:00
I need help with above case statement, When I run the case statement I get 'N/A FSY_2015 ' When I add the following where clause to validate the results. In my table I do have records for all four quarters, Except Q1, all other rows I get 'N/A
FSY_2015 '
Am i missing something? Can someone help me here?
where
datepart(m,[SDate])
between
'12'
and
'02'
and
datepart(m,[PDate]
between
'12'
and
'02'
FMThere is no CASE statement in SQL; it is a CASE expression. Big difference.
Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
The report period table gives a name to a range of dates that is common to the entire enterprise.
CREATE TABLE Something_Report_Periods
(something_report_name CHAR(10) NOT NULL PRIMARY KEY
CHECK (something_report_name LIKE <pattern>),
something_report_start_date DATE NOT NULL,
something_report_end_date DATE NOT NULL,
CONSTRAINT date_ordering
CHECK (something_report_start_date <= something_report_end_date),
etc);
These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Maybe you are looking for
-
Cannot parse UTF-8 encoded xml files
I have been having issues parsing files that were encoded with UTF-8. If I save the file as standard ANSI and parse it I do not have the issues. Is there a reason this can occur? Here is the error I am getting: C:\Home\Java\testbed\tmp>java RFKGenera
-
I need to know how to fix my iphone4 I was playing one of my games and a up date poped up I pushed on the up date when it restarted all I have is a white screen with four black dots and all the driffent laughes and a i with a blue circle around it I
-
What is the T-code to lock the VA01
What is the T-code to lock the VA01
-
I pre0ordered the most recent City and Colour album. When i ordered the album, the funds were withdrawn immediately. When trying to download the pre-order I am being asked to pay for it again. How do i stop this?
-
Hi guys, I'm wondering whether there is a better way to do this. I have some IDs, and some scores, and then I rank them (based on the score) using the rank function. Two scores can have the same rank. I want to flag whether or not a user is tied with