Assigning date value to a date variable
Hi,
How can I hard code a date (09/22/2006) in a date variable? Help me out.
Thank you.
Regards,
Dhana
Hi,
it depends if your input is already parsed and how you want to set the time (hours, etc.).
Two sample ways :
String s = "09/22/2006";
SimpleDateFormat sd = new SimpleDateFormat("MM/dd/yyyy");
Date date1 = sd.parse(s);
Calendar c = Calendar.getInstance();
c.set(2006, 8, 22); //month is zero based
Date date2 = c.getTime();
Btw for basic java programming I would suggest searching for some java tutorials on the net and reading on your own instead of posting in forums. At least for me that is better way to learn.
HTH
Peter
Similar Messages
-
Assigning a value to a substitute variable
Hi, I would like to know if it is possible to assign a value to a substitute variable.
This is what I'm doing:
- Prompting user for input
ACCEPT uom CHAR PROMPT 'Enter number of UOM system you would like: ' DEF '0'
(displayed list of options are numbers 0-5)
- Based on input, open corresponding file
(start i:\utc\all\oracle\uom\uom_column_heading_&&uom..sql)
Problem:
- Default selection is 0, meaning use the CURRENT UOM system (a number, 1-5)
- That being said, &&uom must be assigned a 1-5 value in order to open the file that corresponds to the CURRENT UOM system
Let me know if any additional information is needed.
Thanks!I apologize for the format. I tried to make it more legible, but was not able to. FYI: It appears to be easier to read in "Edit" view.
Thanks, I tried the &&uom := your_function(); suggestion, but I am getting an error. It looks like the "value" of &&uom is being read in the assignment statement, not the variable name.
I have copied the piece of the code, for your reference.
ACCEPT uom CHAR PROMPT 'Enter number of UOM system you would like: ' DEF '0'
DECLARE
v_uom_sys_selection NUMBER;
v_curr_uom_sys VARCHAR2 (50);
v_uom_num NUMBER;
BEGIN
v_uom_sys_selection := to_number(&uom);
v_curr_uom_sys := EG.GET_CURRENT_UOM();
v_uom_num := eg.get_user_selected_uomnum(v_curr_uom_sys);
&&uom := to_char(v_uom_num);
dbms_output.put_line('v_uom_num = ' || v_uom_num);
dbms_output.put_line('&&uom = ' || &&uom);
END;
--prompt "&&uom"
start i:\utc\all\oracle\uom\uom_column_heading_&&uom..sql
Below are the results I get when commenting out the &&uom := to_char(v_uom_num); line. NOTE: the "value" of &&uom = 0.
v_uom_num = 1
0 = 0
If I leave that line in, I get the following error:
PLS-00103: Encountered the symbol "0" when expecting one of the following:
begin case declare end exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "<an identifier> was inserted before "0" to continue.
Message was edited by:
user449676 -
I want to assign the value of a Javascript variable to JSP Variable
I want to assign the value of a Javascript variable to JSP Variable .. for example :
<%
Bla Bla Bla
%>
<script>
var JavaScriptVariable="hello"
</script>
<%
String JSPVariable=// The Value of JavaScriptVariable ;
%>
How can i do that ??
Thanks>I want to assign the value of a Javascript variable to JSP Variable
cannot be done.Friend try to understand concepts properly Javascript is always excuted by the browser @clientside where as JSPCode is executed Websever(ServletContainer) @serverside.Through you are combining JSP Code blocks(Tags,Expressions,scriptlets...) & javascript under a single page webserver can only identify what is their under JSP Code blocks.
Hope this could be an appropriate answer for your question.
However,you can as well submit a request by encoding your URL with request parameters and the submit to the page and then collect it using request.getParameter(name).
But under a single context state it is not possible
REGARDS,
RaHuL -
How to assign a value to the page variable to enable partial page rendering
This is part of my code:
<bc4j:rootAppModuleScope name="App1"
rendered="on@ctrl:page">
Now, I want to change the value of "on@ctrl:page" to "true" after user click a button so that part of the page will be displayed. But how do I assign the value to "on@ctrl:page". I tried to put the followings in my even handler:
<bc4j:setPageProperty name="on" value="true">
<bc4j:parameter name="on" />
</bc4j:setPageProperty>
But it doesn't work. Could someone pls tell me how I should do it.
Thanks a lot!
LingYou should do is:
in your event handle codes,you add the list:
public static EventResult eventname(
BajaContext context,
Page page,
PageEvent event) throws Throwable
EventResult result = new EventResult(page);
result.setProperty("on","true");//or "false"
return result;
then,
change
rendered="on@ctrl:page" -> data:rendered="on@ctrl:eventResult"
also ,you should see the 5th part of 'UIX Developer's Help' -
Assign a value to a global variable - form personalization
Hi All,
We have a requirement in which we want to display a message depending upon the out parameter of the procedure in form personalization.
We are using 'Builtin' with the buitin type 'Execute a Procedure'.
And the argument passed is :
*='declare
l_request_id Number;
l_out_come VARCHAR2(10);
begin
apps.xx_sr_email_pkg1.xx_sr_email_p1
('''||${GLOBAL.XX_CUST_ACCOUNT_ID.VALUE}||''',
'''||${GLOBAL.XX_INCIDENT_ID.VALUE}||''',
'''||${GLOBAL.XX_EMAIL_TYPE.VALUE}||''',l_request_id);
:GLOBAL.XX_REQUEST_ID := l_request_id;
end'*
But its not assigning the value of l_request_id to the gloabal variable XX_REQUEST_ID.
Can you please help?
ThanksI don't have a solution but a work around.
What if you create a function that accepts the same in parameters and returns the message.
And then you create an action of the type message and in the message you call the function such as
= select xx_sr_email_pkg1.sr_email_f1 .... from dual
Sandeep Gandhi -
How to assign bean value to a local variable in JSP using struts.
Hi everybody!
I've a problem that puzzled me on how to assign a bean value to a local variable like String in JSP using struts.
we can have someting like this to display the value
<bean:write name="detailService" property="status" />or
<bean:define id="theStatus" name="detailService" property="status"/>
This is country: <%=theStatus%>but an error occured when I tried like this:
String currentStatus = "<bean:define id="theStatus" name="detailService" property="status"/>";
or
String currentStatus = "<bean:write name="detailService" property="status" />";Is there a way to do this?.....
Any help pretty much appreciatedJava != JSP.
The <bean:define> and <bean:write> tags are custom tags meant to appear in the HTML section of a JSP file, as opposed to the scriptlet section. They actually get turned into java code as part of the translation process.
The <bean:write> tag naturally just writes out what you tell it to.
The <bean:define> tag defines a local variable, and gives it a value.
this should do it.
<bean:define id="theStatus" name="detailService" property="status" type="java.lang.String"/>
<%
String currentStatus = theStatus;
%>With the advent of JSTL, you shouldn't really need to use scriptlet code anymore. Personally I am for 0% scriptlet code in any jsp I write. -
Assign j_user value to a java variable in umLogonPage.jsp
Hi All
I need to do some post processing immediately after login and require the user id for the same. So how do we acess the value in the user id field and assign it to a java variable in the umLogonPage.jsp..??
Java specific forums claim that this is not possible directly and can be only done on submit function or through hidden fields in the form. Any ideas with regard to the form that is present in umLogonPage.jsp..??
Thanks
DeepakHi,
we use this for saving the login time of the user. There are few therads about creating a custom login module (for example: [Custom Login Module - how to go on |http://forums.sdn.sap.com/thread.jspa?threadID=357616]).
We have created a login module which extends AbstractLoginModule, in login() method :
public boolean login() throws LoginException {
Object option = g_sharedState.get("javax.security.auth.login.name");
if (option != null && !option.equals("")) {
String l_userID = (String)option;
IUserAccount l_account = UMFactory.getUserAccountFactory().getUserAccountByLogonId(l_userID);
IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());
l_mutAccount.setLastSuccessfulLogonDate(new Date());
l_mutAccount.commit();
about login modules and login stacks start here: [http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm]
Hope this helps,
Romano -
Assign hexadecimal value to an Integer variable preceding with zero
hi
i need to pass an hexadecimal value, preceding with zero (0).
like 0775
the above hexadecimal value should be assigned to an integer variable. While i am trying to assign it, the output could be truncate the preceding zero value. Is it possible to do my requirement without truncating the preceding zero.?
Edited by: sasi on Jul 23, 2012 7:09 PMI agree on that, this can not be carried out the way you explained.
Either you store the hexadecimal value as a string, and convert it before arithmetic operations:
int number = Integer.parseInt("0775", 16);
Or you store it as an integer (no leading zero) and convert it to string as you display it:
int number = 0x0775;
System.out.printf("%1$04x", number); -
Assigning values to a javascript variable
Hi,
Using request dispatcher, i'm forwarding the control to a html from a servlet like this(obj.forward(/index.html?field1=value1&field2=value2).
In the receiving end, ie., in the html i would like to assign those 2 field1,field2 values to a javascript variables. Javascript located in the index.html.
I don't know how to do this.
Pls any one help me to get of this pblm
Thanks in Advance
Kannan.THi thanks for ur reply,
You r telling while forwarding a request from one
servlet to another servlet, we can't add query
string(requestparameters). But then how come this
code is working?
RequestDispatcher
rdis=getServletContext().getRequestDispatcher("/MyServ
let?type=normal");
rdis.forward(req,res);Well I owe an apology here - I was not completely correct. I have tested and found that you can indeed add parameters that way. The catch is that these parameters are nested to that forwarded /included resource. It is not available in the original jsp or to some other resource included from the original jsp unless ofcourse you add the parameter again.
>
please give me a solution.
Like this i have to forward my request (with
querystring) to a html page.
That htmlpage should receive parameters and assign
the values to a javascript variables.
how can i achieve this.
thanks in advance.My original reply stands.
You cannot do that in a html page. You have to have a jsp that generates the html.
ram. -
How to assign a value to ODI Variable using ODI Procedure
Hi ,
Is it possible to assign a value to a ODI Variable using ODI Procedure ?
If it is possible how we can do that.
BEGIN
IF #Counter=1
Then
#Next_Increment:=#Counter+1;
End if;
END;
In my example I have 2 ODI Variables #counter and #Next_increment.
I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
thanks
prasannaPrasanna,
I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
Please help. -
Can I Access the Value of a Global Variable in a Trigger
I'm using a Global variable in a Package which i use in the BIU Trigger to populate a column. After assigning the value for that global variable, I run an INSERT in the same package. But I find only the default value of the Global variable populated in the column. Can I use a Global Variable in a Trigger? Is there any way to put in a common value across all the tables in an application for all DMLs of a particular session?
Helios,
I'm already having the same setup mentioned in the thread. And I'm doing exactly whats given there. But the issue seems to be something different. I'm assigning the value to the Global Variable in the Package through Apex. Here's the Package Code:
CREATE OR REPLACE PACKAGE Schema1.SPMS_SECURITY_PKG
AS
X_app_user_id NUMBER DEFAULT -1;
FUNCTION USER_ID RETURN NUMBER;
END SPMS_SECURITY_PKG;
CREATE OR REPLACE PACKAGE BODY Schema1.spms_security_pkg
AS
FUNCTION user_id
RETURN NUMBER
IS
BEGIN
-- RAISE_APPLICATION_ERROR(-20001,'USER ID'||'*'||X_app_user_id);
RETURN NVL (x_app_user_id, -1);
-- RETURN NVL (sys_context('USERENV', 'CURRENT_USER'), -1);
EXCEPTION
WHEN OTHERS
THEN
RETURN -1;
END;
And Here is the Trigger Code:
CREATE OR REPLACE TRIGGER Schema1."USER_DETAILS_TRIGGER"
BEFORE INSERT OR UPDATE
ON PMS_SICAL.SPMS_USER_DETAILS REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF INSERTING
THEN
:NEW.created_by := spms_security_pkg.user_id;
:NEW.created_date := SYSDATE;
:NEW.START_DATE := SYSDATE;
ELSIF UPDATING
THEN
:NEW.updated_by := SPMS_SECURITY_PKG.X_app_user_id;--spms_security_pkg.user_id;
:NEW.updated_date := SYSDATE;
END IF;
END;
But I always get -1 in the both in the table after the DMLs. -
PL/SQL Function call error while reading or assigning returned value
Hi,
I am getting the following error while tryih to read the value of the PL/SQL Function. I am calling a function in one of my PL/SQL Packages passing mutliple IN parametes and the function returns some value back. Now on BPEL side when I try to read the return value I am getting an error:
*<summary>*
empty variable/expression result.
xpath variable/expression expression "/ns3:OutputParameters/ns3:TEST_FUNCTION" is empty at line 124, when attempting reading/copying it.
Please make sure the variable/expression result "/ns3:OutputParameters/ns3:TEST_FUNCTION" is not empty.
*</summary>*
Even though in the console when I check the Invoke Output Parameter it does shows me a valid value being retuned by a Function but when I am trying to Assgn this value to some variable using Assign Activity I get the above error.
Even though all goes fine but looks like I am not able to read or assign the value returned from the Function.
So just wondering if this even works as to me I have a very simple example and that seems not to work. Function is called successfully and is returning the value as I can see it in the BPEL console but when tryin to read or assign that value to some other variable I get the above error.
Any ideas?
ThanksThis issue has come up a lot. The problem is with a mismatch between the version of JDeveloper and SOA. You'll encounter namespace issues if you use 10.1.3.1 in combination with 10.1.3.3 (or 10.1.3.4). You MUST synchronize both JDev and SOA to 10.1.3.3 or 10.1.3.4 (mixing 10.1.3.3 and 10.1.3.4 is OK). We changed when going to 10.1.3.3 by adding elementFormDefault="qualified" to the generated XSD. We used the default "unqualified" in 10.1.3.1. So you'll encounter namespace issues unless you're using 10.1.3.3 or higher JDev AND SOA. The fact that I see <*db:*...> tells me that you're using 10.1.3.1 JDeveloper. The correct solution is to upgrade your components.
-
Querying and Assigning Date Value
Hello, this query is not working. I am trying to assign the date value to the from_date variable.
set result_list [execsql "select TCM_DATE_BEGIN_REQD into: TO_CHAR(from_date, 'YYYY/MM/DD') from tcm_tau_component where tcm_reference_number = $tau_reference_number" ]
This is the error I get:
The following bind variable(s) are not defined:
Please help.I don't know what language this is but you're trying to select into a format mask. That looks suspicious. Try this:
select TO_CHAR(TCM_DATE_BEGIN_REQD, 'YYYY/MM/DD') into :from_date ... -
How to assign date value in the report
Hi,
I want to compared between two dates. One date is dynamic and other one is fixed.
for example Date1 = today's date
Date2 = 12/31/9999
How do i fix the date2 in the report.
Please any one help me
Thanks & Regards
Jagannadha Rajuyou can use default values in the properties of the date variable that will allow it to be the data yo uwant it to be
the 2nd date which is current use sap provided variable current data on it as restrickted value( Not default).
hope that helps -
Transfer Rule Routine: Assign Date Value into Blank Field
Can anyone help me with regards to writing some ABAP code in a transfer rule so that I can assign "99991231" value into a date characteristics if it is blank?
Many thanks for advance.I would like to check if the value of EXPIRYDATE is blank in data source. If its value is blank, assign '99991231' to it. Otherwise, it will get the value of EXPIRYDATE in transfer rule. I have rewritten the routine as follows. But there is no effects on the result.
if TRAN_STRUCTURE-EXPIRYDATE IS INITIAL.
RESULT = '99991231'.
else.
RESULT = TRAN_STRUCTURE-EXPIRYDATE.
endif.
Many thanks in advance.
Maybe you are looking for
-
How can I get all the print on my screen to be larger?
How can I get all of the print on my screen to be larger?
-
Do I need DiskWarrior?? Will it fix this problem?
Hello and thank you for reading. I have had issues with my Macbook Pro ever since I swapped out both the ram and hard drive. I thought at first it was a RAM problem but now have been able to boot my mac from the original hard drive, mounted in an e
-
Instead of requested page source code is getting populated in WAS 6.1.0.15
Hi All, I'm trying to bring up an application using jnlp.please find below the source code for the same. When i deploy the application in WAS 6.1.0.0, i'm able to bring up the application without any issue. But other than 6.1.0.0 if i deploy the same
-
Hi all, I have 3 dimensions: TIMES, PRODUCTS, STORES The hierarchy of TIMES, is in the order: year, quarter, month, week, day The hierarchy of Products is in the order: sector, family, sub-family, product The hierarchy of STORES is in the order: area
-
Xp box can only see 1 mac on wireless...
I hope im in the right section....? My set up: 1 MacBook Pro (my work laptop) 1 iMac 24 (shared printer, iTunes lib) 1 PC with XP (partners work laptop) All connected via wireless My iMac has a printer connected and contains the shared iTunes library