Choice Subform Set Data Binding
We would like to use the choice subform set to display different subforms based on whether a hasScore value is set to YES or NO. This will be done repeatedly in the form so we want to try and map all the choice subform sets that use the hasScore value to the same data instance in our XML. When I attempt do this only the first choice subform set works. The rest default to the first subform in the choice subform set. The only way I get the rest of the choice subform sets to work is to duplicate the data instance in our XML to match the number of choice subform sets in the form.
Any way to get all the choice subform sets to use the same data instance in the XML? Or is there a better way to do this without resorting to javascript to show/hide the subforms? The choice subform set looks nice but we don't want to duplicate the XML data to get it to work.
What I have to do when I have 3 choice subform sets that use the hasScore value:
<?xml version="1.0" encoding="UTF-8"?>
<
loan_info>
<score>
<hasScore>YES</hasScore>
</score>
<score>
<hasScore>YES</hasScore>
</score>
<score>
<hasScore>YES</hasScore>
</score>
<scoreValue>742</scoreValue></
loan_info>
What I would like to when I have 3 choice subform sets that use the hasScore value:
<?xml version="1.0" encoding="UTF-8"?>
<
loan_info>
<score>
<hasScore>YES</hasScore>
</score>
<scoreValue>742</scoreValue></
loan_info>
Paul,
I couldn't figure out how to reference the dataset value using the subform set. Not real easy to figure out with the UI for the subform set. Would prefer to just be able to put the JavaScript in the subform set selection code without having to do the dataset selection first. Makes some pretty strange looking data bindings for the subforms that are part of the subform set. Probably could use some more documentation on how to set these bindings up in the Designer help.
We ended up going with a top level ready:form script that could check the credit score Y/N value:
loan_info::ready:form - (JavaScript, both)
if (xfa.datasets.data.loan_info.form_extensions.forminator.hasCreditScore.value == "Y")
loan_info.Page1.Score.presence = "visible";
loan_info.Page1.NoScore.presence = "hidden";
xfa.resolveNode("loan_info.Page1.#subform[3].Score[1]").presence = "visible";
xfa.resolveNode("loan_info.Page1.#subform[3].NoScore[1]").presence = "hidden";
xfa.resolveNode("loan_info.Page1.Score[2]").presence = "visible";
xfa.resolveNode("loan_info.Page1.NoScore[2]").presence = "hidden";
else
loan_info.Page1.Score.presence = "hidden";
loan_info.Page1.NoScore.presence = "visible";
xfa.resolveNode("loan_info.Page1.#subform[3].Score[1]").presence = "hidden";
xfa.resolveNode("loan_info.Page1.#subform[3].NoScore[1]").presence = "visible";
xfa.resolveNode("loan_info.Page1.Score[2]").presence = "hidden";
xfa.resolveNode("loan_info.Page1.NoScore[2]").presence = "visible";
Too bad we couldn't use the subform set. I liked seeing them in the hierarchy - makes ir pretty easy to see what's going on vs. JavaScript buried in the top level ready:form event.
We also had a case where we would have needed to turn on two of the three subforms in the subform set. Might want to consider multiple selection for the subform set in future versions.
Thanks,
Steve
Similar Messages
-
Help w/ choice subform sets or similar?
I'm trying to create a generic documentation submission form and I'd like a user to be able to enter fields of text and images, but in a randomized order (in order to give maximum flexibility to the writer.) I am new to LC and so far I have:
1) been able to dynamically add text and image field subforms, but they remain grouped separately which just doesn't work
2) created a subform set with both a text and image field within it which would allow the user to fill whichever he needed (making one field invisible) but that is totally non-elegant and wastes space
3) played around with choice subform sets which seem tailored specifically to what I need to do, except that the subform choice is not based on imported data, it's based on user selection...
Since I have not been able to find much documentation on the choice subform sets, I was hoping someone here might either tell me how I can bind them via user-selection (like through a button click or radio toggle) or if that's just not possible. Alternately, if anyone has any ideas on how to accomplish something like this, it would be hugely appreciated!! Fyi, I did try tables, but apparently if you have two row types, it groups those together within the table just like it groups regular subforms...makes sense, I guess, since it's all tied to the hierarchy structure...) Anyway, thanks for taking the time to read and respond!could you provide a link for for the engadget article about the floating blacks?
Here's the link to the CNET article. http://news.cnet.com/8301-17938_105-20014089-1.html?tag=mncol;1n
after a quick re-read the amount of hours tested isnt as long as I originally thought, but according to the article they have seen no black level increase. so either they have reverse the problem, or they have found a way to extend the time between incrimental increases of voltages.
as far as the pioneer parts are concerned, I got pretty consistant responses from 3 of our panasonic reps. according to them there are "some" pioneer internals but not enough to claim Panny as a repackaged Pioneer. They claim the "infinite black panel" on the VT20s and 25s is pure pioneer tech, claiming they used some but mainly wanted "to keep the original Viera color wheel" to get better color with gaming to appease that crowd.
Sounded like BS but the fact I got the same answer from 3 diff reps says something at the very least.
If you like posts that I make, be sure to click on the star underneath my name. Thanks! -
How can I set the data binding between Web Dynpro & Database table
Dear friend,
I am a beginner of Web Dynpro. I want to develop my simple project like these:
1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
1. How can I set the data binding between Web Dynpro and Database table ?
2. Are there any nescessary steps that I will concern for this case?
Sorry if my question is simple, I had try to find solution myself, but it not found
Thanks in advances,
SeMsHi,
You can write your own connection class for establishing the connection with DB.
Ex:
public class ConnectionClass {
static Connection con = null;
public static Connection getConnection() {
try{
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
con = ds.getConnection();
return con;
}catch(Exception e){
return null;
You can place the above class file in src folder and you can use this class in webdynpro.
You can have another UserInfo class for reading and writing the data into the DB .
Regards, Anilkumar
PS : Refer
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
Message was edited by: Anilkumar Vippagunta -
Help: Data binding using uix:choice
I have a uix jsp page with the following code snippets (trying to make a simple drop down list):
<jbo:DataSource id="ds2" appid="PubModuleDef" viewobject="PubModule.FOAOIDGroupsVO" />
and further down:
<uix:choice>
<uix:contents>
<jbo:RowsetIterate datasource="ds2">
<uix:option text="<%= ds2.getRowSet().getCurrentRow().getAttribute(\"Name\") %>" />
</jbo:RowsetIterate>
</uix:contents>
</uix:choice>
I am looking for a more elegant way to do this. Particularly I would like to eliminate the <%= ... %> code but I simply have not been able to figure out how to use Data Binding...
Any advice?
ClausHi Matthias,
I hope this is what you are looking for:
http://help.sap.com/saphelp_erp2004/helpdata/en/fb/fbb84c20df274aa52a0b0833769057/frameset.htm
Regards,
Rainer -
ADF UIX programatic data binding
Oracle ADF UIX Developer's Guide mentions the possibility to use the UIX framework in Java, to create new objects or alter the existing ones.
E.g. we can create a table using a construct like:
TableLayoutBean tlb = new TableLayoutBean();
The same document demonstrates the data binding:
BoundValue rows = new DataBoundValue(_YOUR_NAMESPACE, YOURNAME, "rows");
tlb.setIndexedNodeList(new DataObjectListNodeList(rows));
For "simple" attributes using DataObject DataObjectList, etc. the procedure is clear. But what about creating a data bound table or input text:
<table model="${bindings.EmpView1}" ... >
<messageTextInput model="${bindings.DeptCode}"/>
Itâs easy to understand that model="${bindings.EmpView1}" or model="${bindings.DeptCode}" are equivalent to multiple attribute bindings (data, validation, read-only, etc.), but it looks that the classes/methods resolving these equivalences and linking the bean to the corresponding DCControlBinding, are not public (or maybe I was not able to find them).
How can we obtain programmatically, in Java, the same structure as described above (in XML)? The best would be to use the same classes used when the UIX XML document is parsed to create the page description.
It would be very nice to be able to use a structure like
tbl.setModel( new JUCtrlRangeBinding(...) );
txt.setModel( new JUCtrlValueBinding(...) );
or maybe
txt.setAttribute( "model", new TextInputModelBoundValue(...) ) etc.
In JSF we can do something like:
ValueBinding vb = application.createValueBinding(value);
component.setValueBinding(attributeName, vb);
Can we do something similar in UIX?
Any help will be appreciated,
thanks,
Mircea IonitaSince the code is already written, it's a pity that we can't use/extend it. I don't like to say it (sorry) but I find this design choice (implement the "model" only into the XML parsing layer) a little bit strange (or maybe I don't understand... ;-) ). We should (or we are supposed to) be able to do in java everything that we can do in XML.
I would like to find more support/help for the programmatic approach. I have the feeling that you are too focalised on "use-our-state-of-the-art-tools/wizards-to-write-the-code-for-you" and you forgot that this is not suitable for all projects. E.g. our application creates the user interface according to a layout defined by each user. To generate it, we need to use at maximum the extension mechanism and we can't simply relay on "rendered" attribute etc.
-When should we expect this new UIX release?
-What about the UIX controller? The Struts controller will replace it?
-What about the source code of uixexp2-demo.jar (distributed with ADF_UIX_component_guide)?
-Why while debugging we can't set a method/class breakpoint on UIX classes (to understand the data flow) - the stack is secret?
Thanks -
Hi all,
I am trying to create an interactive form in WebDynpro ABAP (using Livecycle Designer 8.0).
This application consists of two screens.
I have a selection screen which populates an internal table in a context node.
The next screen has the interactive form and should create the table dynamically to match the internal table.
I can see the context on this screen as I inserted a simple WD table UI element and it displays the data.
I created my form in the wizard here which allows you to set the interface to be a context node in the application. However the binding is not working at all. In fact when I set the binding attribute in the various subforms, rows etc I get a warning message
"Using 'Normal' data binding when a default data connection is defined may produce undesirable results"
Has anyone experienced this before or can anyone tell me how to set up a dynamic, bound table in WebDynpro ABAP?
Thanks,
GregorHi Gregor,
From your information, I can say that you are having two Views. In the First View you have a selection screen and by the selection screen you are filling the Internal Table which is being used in the next View.
To display the Internal in the Adobe Interactive Form from WebDynpro. Firstly you need to create a main context node and in that context node create another sub node with Cardinality "0..n" and Selection "0..1"and link that to a Table or Structure or leave that blank. i you left blank create attributes of your own or select from the table or structure you have referenced.
Now in the Method you fill sub node after all the select statements written and at end write a code "sub_node_name->bind_table ( internal_table )".
Now after filling the template source it asks for the interface, when filling select the main context node.
I think this will solve your problem.
Regards
Pradeep Goli -
Data Binding for Idiots (me)
Hey everyone,
I've been asked to build a form that is way more complex than anything I've done in the past. I just wanted to ask the experts here a few questions before I get started, to make sure that I don't make any huge mistakes.
The complexity of the form lies in the huge number of nested repeatable subforms, the fact that it's three forms in one (which form being shown depends on a selection from a drop down list), and the fact that the form needs to be designed to export its data cleanly to xml.
As far as building the form goes, I'm comfortable with everything except for the exporting to XML. I've done this a few times, but I'm not sure that the assumptions I've made are correct. I've tried reading the help files, but I'm not sure I'm getting it.
Pretty much, I make use of a ton of subforms in order to make sure that the layout of the form works dynamically. I don't want all of these subforms to show up in the xml import. The way I've been doing it is to set the data binding on these subforms to 'No data binding.' Does this have any impact on how data is saved to the form? If I don't want the value of a field to be exported, can I set it's binding to 'no data binding', or will that cause prevent the values from being saved?
My final question is about the 'Use name' binding. Up until now, in past forms I've made sure that all fields have different names. This form is so large, and has so many similar elements that it would be useful to be able to resue field names in different areas of the form. For example, two of the versions of the forms has a section for associated addresses. The fields in these sections are the same. Can I name them the same thing, so long as they are within different subforms? Or will this cause a conflict when exporting/saving.
Sorry for the long post. In short:
1) What afftect does the data binding 'no data binding' have on subforms and fields, with regards to saved data and exported data? Are there any 'gotchas!' that I should be aware of?
2) What are the guidelines I should follow to ensure that I don't come across any naming conflicts? Do I just need to ensure sibling feilds aren't named the same, or should all names be distinct?
I would appreciate any help that you guys might be able to offer.
- ScottScott,
1) No date binding means a form object is not included in exported XML. Data binding has no effect upon saving data when saving a form, the form will contain the data.
2) For me, rule #1 is use a schema and schema binding. It is worth the upfront investment in time. What you see in the schema is what you see in the output data, given a form object is bound to the schema. You can bind a single schema element to multiple form objects if you need to re-use data across sub-forms, also. Rule #2, again for me, is to explicitly define sub-form names to simplify schema binding and avoid name collisions.
I've attached a very simple form (with the schema embedded), the schema and exported xml to demonstrate.
Steve -
MVC - Performance of data binding
Hi Gurus out there
I have a concern regarding performance of (dynamic) data binding if I have a lot of <i>textEdit</i> fields containing huge amount of data on a view page.
<u>Scenario</u>:
The view page contains buttons <b>[Add textEdit field]</b> and<b> [Save all entries]</b>. If you click the button <b>[Add textEdit field]</b> then a (new) <i>textEdit</i> will be generated and the model remembers the total number of <i>textEdit</i> fields that have been generated.
DATA: textedit_count TYPE i,
o_textedit TYPE REF TO cl_htmlb_textedit,
tabix(6) TYPE c,
binding_code TYPE string,
binding_str TYPE string.
textedit_count = o_model->get_section_count( ).
DO textedit_count TIMES.
* Create a unique ID for a textEdit field:
tabix = sy-index.
CONDESE tabix NO-GAPS.
* String for the data binding of internal table model->data_stream_tab:
CONCATENATE '//model/data_stream_tab['
tabix
'].data_string'
INTO binding_str.
* Dynamic data binding:
CREATE OBJECT o_textedit.
CONCATENATE 'myTextEditID' tabix
INTO o_textedit->id.
o_textedit->width = 650.
o_textedit->height = 225.
o_textedit->_text = binding_str.
binding_code = o_textedit->IF_BSP_BEE~RENDER_TO_STRING( page_context ).
<htmlb:label for = "<%= o_textedit->id %>"
text = "<%= o_textedit->id %>"
design = "EMPHASIZED" />
<%-- Binding of the attribute (internal table) '//model/data_stream_tab<i>.data_stream' --%>
<%= binding_code %>
ENDDO.
Obviously the <u>whole</u> contents of the <i>textEdit</i> fields in the coding above are <u>always</u> "moved" from the web browser to the server and vice versa when the button <b>[Add textEdit field]</b> is hit every time even though the content of some <i>textEdit</i> fields haven't changed.
Does anyone have a good solution/optimization for this problem? Any suggestion, comment and/or answer will be very appreciated.
Thanks
HWPlace this code above any textedit elements you have in your page:
<script type="text/javascript">
var myFields = new Array();
</script>
Then place this code after every textedit elements, this code will get run when the page is loaded in the browser, right after your element. You are saving the ID and the default value of your element to an array. For every further element, increase the array counter by 1!
<script type="text/javascript">
myFields[0] = new Object();
myFields[0]["id"] = 'myTextEdit1';
myFields[0]["default_value"] = document.getElementById(myFields[0]["id"]).value;
</script>
Finally, include this function in your page (does not have to be at the bottom, I just put it here chronologically):
<script type="text/javascript">
function compareFields() {
for (var i = 0; i < myFields.length; ++i) {
if(myFields<i>["default_value"] == document.getElementById(myFields<i>["id"]).value) {
// nothing has changed, set to ignore-value (any highly unlikely value, like ")?.("
document.getElementById(myFields<i>["id"]).value = ')?.(';
// check against this value in your setter method
// if this is set, then do not user submitted value to update your model attribute value
// maybe do some output for debug purposes
// alert(document.getElementById(myFields<i>["id"]).value);
}</script>
Now add this attribute to your submit button:
onClientClick = "javascript:compareFields();"
This should do, test it out and let me know.
Max -
I have created a banded report split into departments. Each
recore has a value associated with it. The report runs fine if I
dont try to sub-total each departments vale, but if I add a
calculated field to the banding, I get the following error:
Report data binding error Error evaluating expression :
textField_2 Source text : calc.Department_Total.
Variable calc.Department_Total is undefined.
The calculated field is simply the sum of the values, with an
initial value of 0 and set to reset when the group changes on the
department. I am using the same data type for the calc field as it
automatically gave for the original Value field (Big Decimal)
Any ideas?
Dave HDoes anyone have any ideas about this, Its getting a bit
critical now. Has anyone else been able to do sums that calculate
on group changes?? The sum total works for the report, jusyt not
the bands. I desparate here, pulling my hair out.
Regards
Dave H -
How to set a bind variable across the pages in a report
I want to create a portal report where data will come from a table for a date range for a week.
For e.g select event_date,last_name, event_name
from RESOURCES
where event_date between trunc(to_date(:curr_date,'DD-MON-RRRR'))
and trunc(to_date(:curr_date,'DD-MON-RRRR')+ 7)
The :curr_date is defined as a bind variable whose default value is sysdate.
Now, when we run the report for the first time, it takes the :curr_date as
sysdate and prints the report.
I have two buttons in the report output like "previous week" and "next week".
If someone presses previous week, the same report should run with curr_date
as sysdate-7 and if someone presses next week, the report should run with
curr_date as sysdate +7 and also the :curr_date sets to sysdate - 7 or sysdate + 7
depending on the button pressed.
Problem:
How do I set the value of curr_date if someone presses any of
previous week/next week.
nullBest to state your JDev version, and technology stack (eg. ADF BC) when posting.
I can think of 2 approaches.
1) Create a parent VO based on SELECT :bindVar FROM dual, then create links between your other VOs and the parent
2) Create a AM client interface method that programatically sets the bind variable in each VO.
Can you specify your use case? This one tends to come up when discussing effective from/to dated queries.
CM. -
The data binding isn't working, what have I done wrong?
I'm writing a very simple WPF app, one view. I've got a few models defined for the small handful of tables this app works with. I'm making some sort of boneheaded mistake, but I can't see what it is. I'm trying to bind to a property of one of the model
classes I've define, to a textbox in a stackpanel. Here's the XAML:
<StackPanel Orientation="Horizontal" Margin="0, 5" DataContext="{Binding cvsSpecMapping}">
<TextBlock Margin="10,0,5,0">Specimen Mapping: </TextBlock>
<TextBox x:Name="txtHl7SpecMap"
Text="{Binding HL7SpecimenTypeName}"
ToolTip="{Binding HL7SpecimenTypeName}"
MinWidth="50"
MaxWidth="100"
MaxLength="250" />
</StackPanel>
Earlier in the same XAML file I've got the following collection view source defined in the windows' resources:
<CollectionViewSource x:Key="cvsSpecMapping" />
This isn't rocket science. Here's the model class definition. I'm removing all but the relevant property:
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace SpecMapException.Models
* This class I am interested in knowing what properties change.
* Also note that the properties in this class do NOT represent all of the properties
* in the Prism.SpecimenMapping table. It only represents what this application has
* to store.
public class SpecimenMapping : INotifyPropertyChanged
private const int MAX_HL7SPECIMENTYPENAME_LEN = 250;
#region class properties
private string _hl7SpecimenTypeName = "";
public string HL7SpecimenTypeName
get { return _hl7SpecimenTypeName; }
set
if (value != _hl7SpecimenTypeName)
_hl7SpecimenTypeName = EnforceMaxLength(value, MAX_HL7SPECIMENTYPENAME_LEN);
NotifyPropertyChanged();
#endregion //class properties
#region local routines
private string EnforceMaxLength(string PassedValue, int MaxLength)
if (PassedValue.Length <= MaxLength)
return PassedValue;
return PassedValue.Substring(0, MaxLength);
#endregion
#region PropertyChanged code
* The usual property changed code.
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
#endregion
And lastly here's the relevant code which I've put into the windows Loaded event:
Models.SpecimenMapping sm = null;
private void Window_Loaded(object sender, RoutedEventArgs e)
var cvsSpecMapNames = (CollectionViewSource)(this.FindResource("cvsSpecMapping"));
cvsSpecMapNames.Source = sm;
So what is the mistake that I've made? Why isn't the data binding to the textbox txtHl7SpecMap working?
(I'm using VS 2013, .NET 4.5.)
RodcvsSpecMapping is a resource and not a property so you should set the DataContext using the StaticResource markup extension instead of Binding:
<StackPanel Orientation="Horizontal" Margin="0, 5" DataContext="{StaticResource cvsSpecMapping}">
Also, the Source property of a CollectionViewSource is supposed to be set to a collection:
private void Window_Loaded(object sender, RoutedEventArgs e)
sm = new Models.SpecimenMapping();
var cvsSpecMapNames = (CollectionViewSource)(this.FindResource("cvsSpecMapping"));
cvsSpecMapNames.Source = new List<Models.SpecimenMapping>() { sm };
You may also want to set a default value of the HL7SpecimenTypeName property to confirm that the binding actually works after you have done the above changes:
public class SpecimenMapping : INotifyPropertyChanged
private const int MAX_HL7SPECIMENTYPENAME_LEN = 250;
#region class properties
private string _hl7SpecimenTypeName = "def....";
public string HL7SpecimenTypeName
get { return _hl7SpecimenTypeName; }
set
if (value != _hl7SpecimenTypeName)
_hl7SpecimenTypeName = EnforceMaxLength(value, MAX_HL7SPECIMENTYPENAME_LEN);
NotifyPropertyChanged();
Hope that helps.
Please remember to mark helpful posts as answer to close your thread and then start a new thread if you have a new question. -
Subform Set visible in Design View and not PDF preview
I have created a form and used several subform sets, all of the sets and subforms within it are set to visible, but when I look at the PDF preview and when I upload the form into my internal system some of the sections are missing. I am not sure what is wrong, can someone please help!?
A subformset is used when you have numerous different subforms that can be laid down but the imbound data stream will determine which subform to lay down. For exmple if you have a form that has a a different verbiage based on state then you can have all of the subforms defined that could possibly go there then when the data is merged the state is derived and only the one for that state is used.
Hope that helps
Paul -
Best choice for a date column in forms
Hello,
I want to know what is the best choice for a date field that the user have to enter manually. I read on a other post that a calender control is not directly implemented in forms 9i. So what is the best choice to be "user friendly" with a date field in a form?
thanks in advance.Hi
Don't know if this would be much use to you, but I wrote this function 'Check_Date' a while back to check whether the user had typed something which could be interpreted as a date. You'd make your date field into a Text Item, and include a call to this function (which could be in your form, or in a library) in the WHEN-VALIDATE-ITEM trigger on the item, ie:
IF NOT check_date(:ITEMS.date_item1, NULL, NULL) THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;This would mean that the user could type 'T' or '*' for today, '+1' for tomorrow, '-7' for one week ago, or the date in a variety of formats. When they leave the field, the function tries to resolve what they've typed into a date, and sets the field to a date in the correct format.
('Display_Alert' is just a function to display a named alert with a message.) It can also be used to check that the date entered doesn't fall outside upper and lower bounds. Code follows:
FUNCTION Check_Date (text_in IN OUT VARCHAR2,
lower_bound_in IN DATE,
upper_bound_in IN DATE)
RETURN BOOLEAN IS
first_letter VARCHAR2(1) := SUBSTR(text_in, 1, 1);
date_ok BOOLEAN;
this_date DATE;
date_diff NUMBER(8);
output_format VARCHAR2(12) := Get_Application_Property(BUILTIN_DATE_FORMAT);
TYPE date_format_table_type IS TABLE OF VARCHAR2(12)
INDEX BY BINARY_INTEGER;
date_format_table date_format_table_type;
BEGIN
--Set up table of date formats in order they'll be tested for
date_format_table(1) := 'DD-MON-RRRR';
date_format_table(2) := 'DD-MM-RRRR';
date_format_table(3) := 'DD-MM';
date_format_table(4) := 'DD-MON';
date_format_table(5) := 'YYYY-MM-DD';
date_format_table(6) := 'YYYY-MON-DD';
--Use of T, or * for today's date...
IF UPPER(text_in) IN ('T', '*') THEN
this_date := SYSDATE;
date_ok := TRUE;
--Look for use of +x/-x for number of days different from today
ELSIF first_letter IN ('+', '-') THEN
BEGIN
date_diff := TO_NUMBER(SUBSTR(text_in, 2));
IF first_letter = '+' THEN
this_date := SYSDATE + date_diff;
ELSE
this_date := SYSDATE - date_diff;
END IF;
date_ok := TRUE;
EXCEPTION
WHEN VALUE_ERROR THEN
--User has entered something like '+X', so not valid
date_ok := FALSE;
END;
ELSE
--Go through all the possible formats for date entry,
--if any give a valid date, then return that.
FOR ix IN date_format_table.FIRST..date_format_table.LAST LOOP
EXIT WHEN date_ok;
BEGIN
--Try creating a date using the format masks in the local
--table. If no good, this will throw an INVALID_DATE exception
this_date := TO_DATE(text_in, date_format_table(ix));
date_ok := TRUE;
EXCEPTION
WHEN OTHERS THEN
date_ok := FALSE;
END;
END LOOP;
END IF;
IF date_ok THEN
--Check for violation of lower/upper bounds on date
IF (lower_bound_in IS NOT NULL AND this_date < lower_bound_in) THEN
Display_Alert('info_alert', 'Date cannot be before '||TO_CHAR(lower_bound_in, output_format));
date_ok := FALSE;
ELSIF (upper_bound_in IS NOT NULL AND this_date > upper_bound_in) THEN
Display_Alert('info_alert', 'Date cannot be after '||TO_CHAR(upper_bound_in, output_format));
date_ok := FALSE;
ELSE
text_in := TO_CHAR(this_date, output_format);
END IF;
ELSE
Display_Alert('INFO_ALERT', text_in||' is not a valid date !!');
END IF;
RETURN date_ok;
END;Hope this is useful.
regards
Andrew
UK -
Problems with Date bind variable
I'm trying to use a Date as a bind variable in a View Object, and I'm running into difficulties. I've got the bind variable type set to date, and the control hints for Format Type and Format set to "Simple Date" and "yyyy-MM-dd" respectively. When I run the application module test and enter the date in the correct format, the View Object returns the expected results. However, when I try to set a Query Bind Parameters property for a JHeadstart group in my application definition in order to set the bind variable's value from an dateField input control, I get the following exception:
30-Jan 08:49:56 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
at oracle.jbo.domain.Date.<init>(Date.java:279)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at oracle.jbo.domain.TypeConvMapEntry.convert(TypeConvMapEntry.java:73)
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:739)
at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:90)
at oracle.jbo.common.VariableImpl.convertToJava(VariableImpl.java:546)
at oracle.jbo.common.VariableValueManagerImpl.doSetVariableValue(VariableValueManagerImpl.java:182)
at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:223)
at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:229)
at oracle.jheadstart.model.adfbc.v2.JhsApplicationModuleImpl.applyBindParams(JhsApplicationModuleImpl.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:507)
at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:1795)
at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:1989)
at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:219)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1289)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:1802)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:627)
at oracle.adf.model.binding.DCInvokeActionDef$DCInvokeAction.refresh(DCInvokeActionDef.java:140)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2521)
at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2260)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareRender(PageLifecycleImpl.java:534)
at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareRender(FacesPageLifecycle.java:98)
at oracle.jheadstart.controller.jsf.lifecycle.JhsPageLifecycle.prepareRender(JhsPageLifecycle.java:1155)
at oracle.adf.controller.v2.lifecycle.Lifecycle$1.execute(Lifecycle.java:297)
at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.mav$executePhase(ADFPhaseListener.java:29)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$1.before(ADFPhaseListener.java:426)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:228)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
However, it seems that the value of the bind parameter did in fact change, according to the debug message issued by the JhsApplicationModuleImpl.applyBindParams(...) procedure:
30-Jan 08:46:23 DEBUG (JhsApplicationModuleImpl) -ViewObject ViewObj: value of bind param move_date has changed: old value=null ,new value=Wed Jan 07 00:00:00 CST 2009
One thing I have noticed that may be of interest - if I run the debugger into the JhsApplicationModuleImpl.applyBindParams(...) procedure, a default date in my bind variable shows up as an oracle.jbo.domain.Date object when it comes out of the following line:
Object oldValue = vo.ensureVariableManager().getVariableValue(key);
as opposed to the new value that gets sent from the input value of the dateField control, which shows up as a java.util.Date in the following line:
Object value = args.get(key);
In the string of functions leading up to the following in the stack trace:
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
at oracle.jbo.domain.Date.<init>(Date.java:279)
it looks like the value of the java.util.Date is converted to a string, then passed to these functions to be turned into a java.sql.Date object. However, according to the java.sql.Date.valueOf(...) function, it's expecting date in "yyyy-mm-dd" format, per the header comments:
* Converts a string in JDBC date escape format to
* a <code>Date</code> value.
* @param s a <code>String</code> object representing a date in
* in the format "yyyy-mm-dd"
* @return a <code>java.sql.Date</code> object representing the
* given date
* @throws IllegalArgumentException if the date given is not in the
* JDBC date escape format (yyyy-mm-dd)
When the input value from the dateField input control is added as a java.util.Date, the toString() is producing the wrong date format, which could be seen in the debug output I included above that said the bind variable has changed.
Has anyone done this before that can let me know what I am missing and how to fix this? I've search all over the web, and all the articles I've seen relating to bind variables only refer to those of numeric or string types, which aren't giving me any trouble. Even the Developer's Guide (http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b25947/bcquerying009.htm) article "5.9 Using Named Bind Variables" doesn't reference using a Date type.I had the same problem about a year ago (using JHeadstart 10.1.3.2.52):
15-feb 14:10:31 DEBUG (JhsApplicationModuleImpl) -Search item matches query bind param SubjectenKernPeildatum, value set to 2000-01-01
15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -Executing applyBindParams for BasServiceKern.AdresRollenSubjecten
15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -ViewObject AdresRollenSubjecten: value of bind param peildatum has changed: old value=null ,new value=Sat Jan 01 00:00:00 CET 2000
15-feb 14:10:33 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
It appears a java.util.Date gets put on the criteria Map in the searchBean, this can't be used as input for a jbo.Date bindvariable.
My ugly solution was to override public void applyBindParams(String voUsage,HashMap args)
in MyProjectApplicationModuleImp (which extends JhsApplicationModuleImpl of course),
check if value is a java.util.Date, and then
value = new java.sql.Date(((java.util.Date)value).getTime());
Greetings, HJ
Edited by: HJHorst on Feb 6, 2009 12:22 AM -
How to set Date in input field by hard coding in application
Hi all,
1.I have to make a date(its my choice to set the date) to appear in input field which is date type.
2.How to compare two numbers of type decimal. for example greatest of two numbers
urgent requirementHi
Check the http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
Sample Code
Date now = new Date();
DateFormat df = DateFormat.getDateInstance();
String s = df.format(now);
System.out.println("Today is " + s);
java.sql.Date descends from java.util.Date, but uses only the year, month and day values. There are two methods to create a Date object. The first uses a Calendar object, setting the year, month and day portions to the desired values. The hour, minute, second and millisecond values must be set to zero. At that point, Calendar.getTime().getTime() is invoked to get the java.util.Date milliseconds. That value is then passed to a java.sql.Date constructor:
Calendar cal = Calendar.getInstance();
// set Date portion to January 1, 1970
cal.set( cal.YEAR, 1970 );
cal.set( cal.MONTH, cal.JANUARY );
cal.set( cal.DATE, 1 );
cal.set( cal.HOUR_OF_DAY, 0 );
cal.set( cal.MINUTE, 0 );
cal.set( cal.SECOND, 0 );
cal.set( cal.MILLISECOND, 0 );
java.sql.Date jsqlD =
new java.sql.Date( cal.getTime().getTime() );
The second method is java.sql.Date's valueOf method. valueOf() accepts a String, which must be the date in JDBC time escape format - "yyyy-mm-dd". For example,
java.sql.Date jsqlD = java.sql.Date.valueOf( "2010-01-31" );
creates a Date object representing January 31, 2010. To use this method with a Calendar object, use:
java.sql.Date jsqlD = java.sql.Date.valueOf(
cal.get(cal.YEAR) + ":" +
cal.get(cal.MONTH) + ":" +
cal.get(cal.DATE) );
which produces a Date object with the same value as the first example.
Regards
Ayyapparaj
Maybe you are looking for
-
Error in Enhancing the Standard SAP Enterprise Service
Hi All, I have enhanced standard SAP Enterprise service, when i am going to test in wsnavigator , I am facing the below problem.. ERROR : Definition of /wsdl:definitions/wsdl:types/xsd:schema[1]/xsd:attributeGroup/xsd:attribute is not correct. Missin
-
Remove partitions from a Hard Drive
I am using Win 8.1 Pro. I am taking a harddrive from another computer which as a boot partition and 2 other partitions. I would like to completely reformat the drive to remove the partitions so I end up with just one partition of 500MB ( which is t
-
HOw to upload test files in XI directory
Hi all, I want to upload test file from my local system to XI directory. how can i do this. There is one customized transaction cg3z for this . but consider that this is not available in my case. Is there any alternative way to upload the file in to
-
Exporting or saving AE motion paths
Hello all, A slightly odd request, and I have a feeling it's not going to be possible, but... is there a way to export or save motion paths out of AE? Just like bringing vectors in from Illustrator, but in reverse. I have a very large comp which I'm
-
Error installing certificate with Cisco 5508 7.4.110
hi All, I am getting Error while installing the web certificate on a WLC. (Cisco Controller) >transfer download start Mode............................................. TFTP Data Type........................................ Site Cert TFTP Server IP...