How to bind xml or any data to a mobile list in Dreamweaver?
I am trying to figure out what should be a simple thing in Dreamweaver.
That is while using jquery mobile, how do I attach an xml file to the attribute list elements?
If that isn't possible, would someone be able to tell me or direct me to a way to handle data within Dreamweaver for mobile apps. I'm over the top trying to figure out all of the technologies. It appears that HTML5, xml, sqlite, and json all have possibilities. I have a simple database of maybe 300 items: an image and a description. The data will reside and be read client side on the mobile app.
I want to read the items into a list. Then call up individual items on a new "page" based on the user's list item selection. This is so easy in Dashcode under Mac. Surely, I must be missing something in Dreamweaver 5.5.
TIA to anyone who tries to point me in the right direction.
Have a look here http://books.google.com.au/books?id=kJ5ZWFZtWFgC&pg=PA113&lpg=PA113&dq=spry+datasets+and+j query+mobile&source=bl&ots=l8vMEvoRZn&sig=rZYgQGSdsxX64jCQPnFFqJdMwFg&hl=en&sa=X&ei=xpwPT8 GRIumiiAeztrQK&sqi=2&ved=0CF4Q6AEwBw#v=onepage&q=spry%20datasets%20and%20jquery%20mobile&f =false (apologies for the lenth of the URL) and here http://foundationphp.com/dwmobile/
Gramps
Similar Messages
-
How to bind XML to Datagrid?
My xml is here:
<?xml version="1.0"?><ITRequests><CallInfo><id type="INT UNSIGNED">42</id><request_no type="VARCHAR">1313_IT_220520100709</request_no><requester_uid type="VARCHAR">administrator</requester_uid><request_date type="VARCHAR">22-May-2010 07:09:34 PM</request_date><title type="VARCHAR">Printer Installation</title><status type="VARCHAR">Closed</status></CallInfo><CallInfo><id type="INT UNSIGNED">43</id><request_no type="VARCHAR">1314_IT_220520100718</request_no><requester_uid type="VARCHAR">administrator</requester_uid><request_date type="VARCHAR">22-May-2010 07:17:49 PM</request_date><title type="VARCHAR">Software Installation</title><status type="VARCHAR">In Progress</status></CallInfo><CallInfo></ITRequests>
I don't know how to bind this to a simple datagrid.
Can someone help me please?
PS: The data is in a String variable.
Thanks,
NithGetting your data in the form a string is a PITA. Can you just use the XML itself, and convert it to an ArrayCollection? Then you could just use an HTTP request, for instance, to retrieve it.
Anyway, here is the code you need. It also demonstrates using E4X syntax to filter out the root node.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"creationComplete="initApp()"
>
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.collections.ArrayCollection;
private var strData:String = "<?xml version='1.0'?><ITRequests><CallInfo><id type='INT UNSIGNED'>42</id><request_no type='VARCHAR'>1313_IT_220520100709</request_no><requester_uid type='VARCHAR'>administrator</requester_uid><request_date type='VARCHAR'>22-May-2010 07:09:34 PM</request_date><title type='VARCHAR'>Printer Installation</title><status type='VARCHAR'>Closed</status></CallInfo><CallInfo><id type='INT UNSIGNED'>43</id><request_no type='VARCHAR'>1314_IT_220520100718</request_no><requester_uid type='VARCHAR'>administrator</requester_uid><request_date type='VARCHAR'>22-May-2010 07:17:49 PM</request_date><title type='VARCHAR'>Software Installation</title><status type='VARCHAR'>In Progress</status></CallInfo></ITRequests>";[
Bindable]
private var acData:ArrayCollection;
private function initApp():void{ getCallInfo();
private function getCallInfo():void{
//Convert string to XML:
var sxml:XML = new XML(strData);
//Create an ArrayCollection.
//Just get the 'CallInfo' nodes (ignoring the root node, 'ITRequests'):
acData =
new ArrayCollection(new XMLListCollection(new XMLList(sxml..CallInfo)).toArray());
trace(acData);}
]]>
</mx:Script>
<mx:DataGrid
dataProvider="{acData}">
<mx:columns>
<mx:DataGridColumn dataField="id" width="50"/>
<mx:DataGridColumn dataField="request_no" width="180"/>
</mx:columns></mx:DataGrid>
</mx:Application> -
How to convert xml to ABAP data?
Hi Expert,
I need to write a transformation and convert an XML file into ABAP data.
The XML looks like following:
<?xml version="1.0" ?>
- <ServiceProtocol version="2.1">
- <CmdTest CheckId="123456789">
- <ExceptionMessage>
<id>003</id>
<text>Test</text>
- <arguments>
<argument>2.2</argument>
<argument>2.1</argument>
</arguments>
<creator>Hello</creator>
</ExceptionMessage>
</CmdTest>
</ServiceProtocol>
I have no knowledge in transformation. Can some one help me on this or provide deatail guideline on the conversion of XML to ABAP data.
Thanks in advance,
Best Regards, Johnney.Hi Johnney,
It's actually not that difficult. For that little XML of yours, I would suggest a Simple Transformation, because it's ... simple. And fast.
You should do some reading in the online documentation, and then it's trial-and-error. To accelerate your trialling, I've prepared a little example for you. Which you can use as follows.
Call SE80, and go Workbench > Edit object... , and create a "Transformation" (you give it a suitable name, and click on the "Create" button; in the pop-up, you specify Transformation type = "Simple transformation").
In the source code, you replace everything between "<tt:transform>" and "</tt:transform>" with the following bit of code:
<tt:root name="PROTOCOL_VERSION"/>
<tt:root name="CHECK_ID"/>
<tt:root name="MESSAGE_ID"/>
<tt:root name="MESSAGE_TEXT"/>
<tt:root name="CREATOR"/>
<tt:root name="T_ARGUMENTS"/>
<tt:template>
<ServiceProtocol>
<tt:attribute name="version" value-ref="PROTOCOL_VERSION"/>
<CmdTest>
<tt:attribute name="CheckId" value-ref="CHECK_ID"/>
<ExceptionMessage>
<id>
<tt:value ref="MESSAGE_ID"/>
</id>
<text>
<tt:value ref="MESSAGE_TEXT"/>
</text>
<arguments>
<tt:loop name="Arguments" ref="T_ARGUMENTS">
<argument>
<tt:value ref="$Arguments.ARGUMENT"/>
</argument>
</tt:loop>
</arguments>
<creator>
<tt:value ref="CREATOR"/>
</creator>
</ExceptionMessage>
</CmdTest>
</ServiceProtocol>
</tt:template>
Your simple transformation is ready; all you have to do is call it from a little program, more or less as follows:
DATA:
l_prot_version TYPE string,
l_check_id TYPE string,
l_msg_id TYPE string,
l_msg_text TYPE string,
l_creator TYPE string,
BEGIN OF ls_arguments,
argument TYPE string,
END OF ls_arguments,
lt_arguments LIKE STANDARD TABLE OF ls_arguments.
TRY.
CALL TRANSFORMATION your_transformation_name
SOURCE XML l_xml_string
RESULT protocol_version = l_prot_version
check_id = l_check_id
message_id = l_msg_id
message_text = l_msg_text
t_arguments = lt_arguments
creator = l_creator.
CATCH cx_st_error.
* Your error handling comes here...
ENDTRY.
The variables starting with "l_" should be character fields of appropriate length, or character strings, while "lt_arguments" should be a standard table with a single field called "ARGUMENT" (otherwise you'd have to change the name in the transformation, in the line that says "<tt:value ref="$Arguments.ARGUMENT"/>").
There's more pitfalls for you, like the encoding of the XML string, but you'll find examples of how to handle that if you look for class CL_ABAP_CONV_IN_CE, either here in the forum or in your system (or in the online help, of course).
Oh, and you should definitely catch and handle CX_ST_ERROR - transformations dump easily if something is wrong with the data.
Hope this helps - sure took longer than planned...
Rainer -
How to generate XML from relational data : PL/SQL or Java
I'm new to Oracle XML and would appreciate some advice. I've been asked to generate XML documents from data stored in relational tables. The XML documents must be validated against a DTD. We will probably want to store the XML in the database.
I've seen a PL/SQL based approach as follows :
1.Mimic the structure of the DTD using SQL object types 2.Assign the relational data to the object type using PL/SQL as required
3.Use the SYS_XMLGEN package to render the required XML documents from the SQL objects
However, creating the object types seems to be quite time consuming (step 1 above) for anything other than the simplest of XML documents.
I've also seen that there is the Java based approach, namely :
1. Use the XML generator to build Java classes based on a DTD.
2. Use these classes to build the required XML
On the face of it, the Java based approach seems simpler. However, I'm not that familiar with Java.
Which is the best way to proceed ? Is the PL/SQL based approach worth pursuing or should I bite the bullet and brush up my Java ?
Is it possible to use a combination of PL/SQL and Java to populate the dtd generated java classes (step 2 of the Java approach) to reduce my learning curve ?
Thanks in advanceTo help answer your questions:
1) Now, in 9iR2, you can use SQL/XML as another choice.
2) You can also use XSU to generate the XML and use XSLT to transform it to a desired format instead of using object views if possible.
3) XDK provide Class generator support to populate XML data to Java classes. -
HOW to use xml to transfer data from database?
Hi,
Would you please give me some suggestion on how to use xml connect with a table in oracle/MS_access database?
Thanks a lot
ZhaoHave you already had a look at our online documentation here on OTN, or at a book like Building Oracle XML Applications? There are lots of examples in those.
If you have a specific question about using the API's that's not working for you, we can help out here. -
How to bind xml generated by guide in Soap request message and then unbind it?
Hi
I have issue in "invoke web service" in adobe LC process ?
Actually , i have process, a long lived, which take input as xml . this xml(data) it get from guide data submission in browser by user?
Now , what i need to achieve here is that i have to invoke this long lived process in one of my other process via "invoke web service" option.And to do that, i need to bind the xml into Soap message and then it unbind to back same xml in the other process to use it?
so, my question here is how can i achieve that?Hello Iñaki
Thanks for your reply.
I had read the blog about the XMLAnonymizerBean. It looks very straightforward, and in theory should do just what I need.
I've added the anonymizer bean as the first module as the SOAP message is asynchronous, and I want to remove the namespaces from the request.
I want to exclude all namespaces so I haven't set any parameters.
The SOAP channel in Communication Channel monitor has a status of 'Channel Started but inactive'. I cannot see any messages in the Processing Details for this channel, even though I have sent test messages from Java code and from RWB (the message from RWB without the namespace does reach the receiver). This makes me wonder if I have not configured the interface to use the new SOAP channel correctly, although I can see it in the Receiver Determination configuration overview.
I can see the messages in SXMB_MONI but can't find which communication channel is being used by the sender.
I'm using PI 7.1.
regards
Steve -
TableView in MVC - how to bind view to controller data?
Hi,
I have a default view in my BSP with a tableView on it. I have set the table and iterator variables. In the controller DO_INIT I am selecting the reqd data - how do I pass this data to my table view?
I have created a iterator class and implemented the required methods - how should I use this iterator class to move the data to the view.
In the DO_REQUEST method I am setting the attributes for the view - the table values and also iterator attribute, but its not working...
Thanks
KiranAll right we will try this one question at a time:
>How do I use the iterator, where do I implement the std. methods of the iterator interface.
I think that has already been answered in another thread after your question. But just to be clear, the iterator is generally a completly separate class that implements the interface IF_HTMLB_TABLEVIEW_ITERATOR. I said generally, because technically this can be any object that implements this interface. You could implement this interface in your model, your controller, or your application class - but this is not advised. I like to create a separate class and instaniate it either in my model or my application class. I store the object reference as an attribute of the hosting object. This makes the iterator easily accessible when you need it.
>How will my view know that it has to use the iterator class that I create?
It doesn't. Nor does it need to. The view has nothing to do with the iterator. The iterator is not a general method for generating Extension Elemetns (that is what the BEE is for). The iterator class is specific to the element htmlb:tableView and can only be used with this element. The Iterator instance is passed into the tableView during the definition of this element in the view. The class behind the tableView will then use and interact with the iterator class at the correct times. The table will pass the correct data into the iterator object so that the iterator can pass over either the column, the row, or the cell (the three different methods of the interface) and change the rendering of the tableView.
>I am new to MVC and dont know how to create biding between view & model attribute.
Yes Data binding is done between a view and a model (the model's attributes) not the controller. Data binding is very useful as metadata about fields can be consumed automatically by UI elements in the View. It also handles Input Handleing for you. I can't explain the entire concept of MVC and databind in a thread posting - as that wouldn't do it justice. However there are blogs, on-help and chapters in certain BSP Books dedicated to just that topic.
>Finally is the model class & application class one & the same?
No they are very different objects with different purposes. Application classes existed before MVC was supported by BSP. You can have one and only one application class per BSP application. They are used in stateful applications to store data and object references over the entire lifetime of the application. They can also be holders for application logic that spans the entire application. However since the introduction of MVC (in release 6.20) they should take a back seat to full MVC. MVC separates the presentation logic (view), flow and eventing (Controller) and Application Logic (Model) into separate objects. In a BSP application you can have 0:n model objects. Technically a model class is any standard ABAP class that inherits from CL_BSP_MODEL2. You create them in the ABAP Editor like any other class. However the inheritance has methods that can be called by the BSP and MVC framework to perform functions like data binding. -
How to bind XML in Actionscript?
I'm having difficulty working with binding in actionscript. In MXML I can use the following line:
<mx:Label x="117" y="40" text=" {stationXML.getItemAt(Station-1).CDL0.@value}" id="lblTest"/>
However, in actionscript, I cannot seem to get the binding to work! I tried the following:
BindingUtils.bindProperty(lblTest,"text",stationXML.getItemAt(Station-1).CDL0,"value");
Any ideas how I can do this in Actionscript? I need to do it in ActionScript becuase the "CDL0" value will need to be replaced at times with "CDL1", "CDL2", etc...I solved the issue, so if anyone else has the same problem, here's what I did (after much aggravation):
The reason I didnt use MXML binding was because I wanted to be able to change it from "CDL0" to "CDL1" to "CDL3" without manually changing bindings.
What I set in MXML for the text was:
{stationXML.getItemAt(Station-1).child(cdlstr).@value}
where 'cdlstr' was a public string declared (and set) elsewhere in the program.
So I could make 'cdlstr' = "CDL0" or "CDL1" or even "CDL" + i (if I wanted to make life easy). Just needed to remember to make 'cdlstr' a bindable variable or else it all falls apart.
Hope it helps someone else. -
How to process XML into ABAP data?
Hi,
I have a string variable which content is a xml file. Then how to extract data from it into corresponding ABAP data objects like internal table or structure?
Thanks a lot!HI Long
check this code which converts xml to bap internal table using DOM
REPORT Z_XML_TO_TABLE.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table
size =
l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
create a node iterator
iterator = node->create_iterator( ).
get current node
node = iterator->get_next( ).
loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
regards
kishore
reward if helpful -
I hope you understand what I mean because English is not my language but Dutch.
Example: 17-11-2014
16-11-2014
15-11-2014 so I recieved my e mails and now
15-11-2014
16-11-2014
17-11-2014
and I want that the newest date become up
I hope their is someone to help me.
Thanks.
HeinjaIn English: ;-)
Click on "Date" to sort by date. Click it again to reverse the sorting.
Or, in the menu, '''View|Sort By''' and select '''Date''' and '''Ascending '''or '''Descending '''as you require. You probably want '''Unthreaded''' too. -
How to create XML element with out creating a document
I ve been looking for hours for a method to create an XML element without the need for the Document. I am trying to create objects that access the database, and I need in each of these objects a method that returns only an element (ie. getXMLData()). And in the class that created these object, I nee to call the getXML() methods and construct a document. However, I am not looking to create the document if I am not going to use it. In the component class I need to be able to traverse the xml element and read and modify the values. Is there a way to do so with sun's JDK ?
I ve been looking for hours for a method to create an
XML element without the need for the Document.
... I am not looking to create the document if I
am not going to use it.Hi M-A,
Though you have been told the solution, let's stick to your original issue, just for the sake of interest. I gather what you have in mind is finding the answer to the following question: is there a way of creating a document without having to bind it to any data source? The answer is yes. What you might need is the createDocument() method of the DOMImplementation interface which offers lightwight document handling by obviating the need to construct a particular DOM instance. (You could also use the getDOMImplementation() method of the DOMImplementationRegistry interface, but it has bugs.) Here's a sample code:DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
DOMImplementation domImpl = parser.getDOMImplementation();
Document doc = domImpl.createDocument(null, "rootnode", null);The above code produces the following document:<?xml version="1.0" encoding="UTF-8"?>
<rootnode/>You can make this document even skinnier if you pass null values to all three parameters of the createDocument() method, in which case the document will only contain the prolog. I think both the creation and the structure of this document are simple enough for you to use it as some sort of utility (e.g. by putting the code in a separate class) for creating elements. -
How to bind list data to XML Web service request
How do I bind specific columns in a DataGrid to the Web
service request? I'm having trouble finding any documentation that
addresses that specific pattern, i.e. sending a complex list to the
server via a Flex Web service send() command. I'm fairly new to
Flex programming and don't know if what I want to do is possible.
Here what I've been able to do so far.
1. Using a Web service called a service on the server and
retrieved a complex list.
2. Poplulated a DataGrid with the result
3. The user has selected multiple rows from the DataGrid
using a checkbox column
4. The user pressed a button that calls a Web service send().
This Web service should only send data from only two columns and
only for those rows the user has checked.
5. I can loop over the DataGrid and find the selected rows
and put them in another ArrayCollection called 'selectedRows'.
The issue is that I don't know how to bind 'selectedRows' to
the Web service. Right now I'm reading up on "Working with XML" in
the Programming with ActionScript 3.0 chapter. But I'm just fishing
here. No bites yet.Don't bind. Build the request object programatically, as you
are doing with your selectedRows AC, and send(myObject) that.
Tracy -
How to bind an aggregated list to a variable in an IN or ANY clause
Hello, and thank you for helping -
I have a process that involves a parameter assertion, the result of which is a string for an IN or ANY clause. I am not able to figure out how to bind the result of the assertion to to executable SQL. The actual business process is long and laborious and, I decided, not worth explaining for the purpose of this forum. I have abstracted the process into some dummy data. The goal is to bind v_any_condition to :a. I could certainly build the SQL without the binding, but I would be very interested to know just the same what I am missing here (I'm sure something simple, or just a basic SQL rules that I have missed).
Thanks!
DECLARE
-- The goal is to bind v_any_condition in an ANY clause
v_any_condition VARCHAR2(30) DEFAULT '4,9,d'; -- the three rows to return from the sample data
-- v_any_condition VARCHAR2(30) DEFAULT DBMS_ASSERT.ENQUOTE_LITERAL('4')||','||
-- DBMS_ASSERT.ENQUOTE_LITERAL('9')||','||
-- DBMS_ASSERT.ENQUOTE_LITERAL('d');
v_sql varchar2(2048);
-- We'll create a simple cursor of VARCHAR2(1) just like DUAL.DUMMY
rc sys_refcursor;
rc_record dual%ROWTYPE;
v_counter NUMBER DEFAULT 0;
BEGIN -- Build the SQL. In this example, we decompose an aggregated string
-- containing the first 16 hex numbers. The result is a simple 16-row table
-- from which we will attempt to return the three rows by binding
-- v_any_condition to ANY in the SQL below.
v_sql := '
SELECT token
FROM ( -- materialize the list
WITH t AS (SELECT ''0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f'' AS txt FROM DUAL)
-- then decompose the list into rows
SELECT REGEXP_SUBSTR (txt, ''[^,]+'', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,''[^,]*''))+1
/* WHERE token = ANY(''4'',''9'',''d'') */ -- hardcoding works
WHERE token = ANY(:a) -- binding does not work; the goal is to get this to work '
OPEN rc FOR v_sql USING v_any_condition; -- when binding, we never even enter the loop
LOOP
v_counter := v_counter + 1;
FETCH rc INTO rc_record;
EXIT WHEN rc%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (v_counter || ': '||rc_record.dummy);
END LOOP;
END;
Edited by: ltps on Jan 9, 2012 4:28 PMSuperb. Thank you very much.
For anyone who is interested in the solution I chose, here is the revised SQL that accepts a list as a bind variable after casting the list as a table. The "split string" code is below that. (What look like double quotes in the block below are actually consecutive single quotes.)
DECLARE
v_any_condition VARCHAR2(30) DEFAULT '4,9,d';
v_sql varchar2(2048);
rc sys_refcursor;
rc_record dual%ROWTYPE;
v_counter NUMBER DEFAULT 0;
BEGIN
v_sql := '
SELECT token
FROM (
WITH t AS (SELECT ''0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f'' AS txt FROM DUAL)
-- then decompose the list into rows
SELECT REGEXP_SUBSTR (txt, ''[^,]+'', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,''[^,]*''))+1
, TABLE(CAST(XX_SPLIT_STRING(:a,'','') AS XX_SPLIT_TABLE)) cst
WHERE cst.column_value = token'
OPEN rc FOR v_sql USING v_any_condition;
LOOP
v_counter := v_counter + 1;
FETCH rc INTO rc_record;
EXIT WHEN rc%NOTFOUND;
DBMS_OUTPUT.PUT_LINE (v_counter || ': '||rc_record.dummy);
END LOOP;
END;
-- And the main SQL, just for clarity:
SELECT token
FROM (
WITH t AS (SELECT '0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f' AS txt FROM DUAL)
SELECT REGEXP_SUBSTR (txt, '[^,]+', 1, LEVEL) AS token
FROM t
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(txt,'[^,]*'))+1
, TABLE(CAST(XX_SPLIT_STRING('4,9,d',',') AS XX_SPLIT_TABLE)) cst
WHERE cst.column_value = token;
CREATE OR REPLACE FUNCTION XX_SPLIT_STRING (
p_string VARCHAR2
, p_delimiter VARCHAR2 DEFAULT ','
RETURN XX_SPLIT_TABLE PIPELINED
IS
l_idx PLS_INTEGER;
l_string VARCHAR2(32767) := p_string;
l_value VARCHAR2(32767);
BEGIN
LOOP
l_idx := INSTR ( l_string, p_delimiter );
IF l_idx > 0 THEN
pipe ROW ( SUBSTR ( l_string, 1, l_idx - 1 ) );
l_string := SUBSTR ( l_string, l_idx + LENGTH (p_delimiter) );
ELSE
PIPE ROW ( l_string);
EXIT;
END IF;
END LOOP;
RETURN;
END XX_SPLIT_STRING; -
1. Is there a way to import large XML files into HANA efficiently?
2. Will it process it node by node or the entire file at a time?
3. Are there any data services provided to do this?
This for a project use case i also have an requirement to process bulk XML files, suggest me to accomplish this taskHi Patrick,
I am addressing the similar issue. "Getting data from huge XMLs into Hana."
Using Odata services can we handle huge data (i.e create schema/load into Hana) On-the-fly ?
In my scenario,
I get a folder of different complex XML files which are to be loaded into Hana database.
Then I gotta transform & cleanse the data.
Can I use oData services to transform and cleanse the data ?
If so, how can I create oData services dynamically ?
Any help is highly appreciated.
Thank you.
Regards,
Alekhya -
How to convert indesign document's data into the xml file
Hi all,
First let me explain what exactly i am trying to do.
just i want to ge all page items data (type,frame etc ) from a document and i want to convert all those data into my xml structure .
now i am able to get page item's data from a document . i dont know how to approach it further
any advise ? how do i approach it?.
Experts Please help!What are you trying to achieve specifically. Did you look into IDML to see if suits your needs?
Manan Joshi
- Efficient InDesign Solutions -
MetaDesign Solutions
http://metadesignsolutions.com/services/indesign-development.php
Maybe you are looking for
-
I am trying to use a short mp3 file as a ringtone. So far every website has told me that all I have to do is drag the file into the "ringtones" folder that is located in the menu bar on the left side of I-tunes. I don't have this folder. Again, ev
-
PU19 Tax Reporter - Form 941spool missing after 4.6c to ECC 6.0 upgrade
Hi Experts, We recently underwent a technical upgrade from 4.6c to ECC 6.0.When we use PU19 tax reporter Form 941 as it is a federal tax return form in US .When i check in job spool is not coming.Please let me know if some note is release for spool
-
Using the FilenameFilter interface to get the extension of a file
Hello... I am trying to write a java program which is going to parse multiple xml documents and load them into the db. In a directory, there could be files other than xml files. Hence, i want to parse only files which have an .xml extension. I am usi
-
hi i have a scenario : IDOC (orders) to Flat File. can you guys plz help in mapping. the input format to XI is in the given way idoc a1---(0-1) a2---(0-1) b1-- a3---(0-1) b1---(0-n) c1--- b2--- c1--- a3---(0-n) b1--- b2--- a3--- b1--- b2--- a3 b1---
-
Dear all, First, Thank you for your attention!!! I have to use a network analyzer to perform a test for the return loss of antenna. For convenience, I have to use both port 1 and port 2 in order to test two samples together. Because I plan to use mec