Advanced Accordion from XML
Hello,
I am trying to build an accordion that will present a list of
blog authors as accordion panel tabs and their latest post titles
in the accordion content panel. My xml data looks like this:
<Channels>
- <channel name="Blogger01">
- <title>Title01aaa</title>
- <title>Title01bbb</title>
- <title>Title01ccc</title>
</channel>
- <channel name="Blogger02">
- <title>Title02aaa</title>
- <title>Title02bbb</title>
</channel>
</Channels>
Each blogger may have a different number of titles, so I
cannot utilize a solution with a fixed number of repeats for the
titles. I suspect what I need is some "while" test that will echo
as many title rows as exist without repeating the blogger tab.
Ultimately, this is my goal:
Blogger01 [AccordionPanelTab]
Title01aaa [AccordionPanelContent]
Title01bbb
Title01ccc
Blogger02 [AccordionPanelTab]
Title02aaa [AccordionPanelContent]
Title02bbb
Any advice would be greatly appreciated.
Fishbine wrote:
> What I am trying to get is this:
> -----------
> Blogger01 [AccordionPanelTab]
> -------------
> Title01aaa [AccordionPanelContent]
> Title01bbb
> Title01ccc
> -------------
>
> Any other advice?
>
I went to the nested dataset page and found an example:
http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html#spryr egion8
If that doesn't take you to the nested list section, do a
search for "This would yield".
So I made a quick demo page using your sample "channels" xml
from your initial post and it seemed to work well with the parent
dataset and a nested dataset. I then went to this page:
http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample2.html
and took a look at the repeating code for the second example,
and I was getting closer, but I noticed that the accordion wasn't
working well, and I figured out that the repeating was being done
after the accordion constructor was running and thereby creating
duplicates of the first tab only. I then read some more on the
repeating code and I saw there was data region observer which is
used to create the accordion from the generated data, not from the
"empty" code template. I ended up with something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryNestedXMLDataSet.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryAccordion.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new Spry.Data.XMLDataSet("nesteddatasets.xml",
"Channels/channel");
var dsTitles = new Spry.Data.NestedXMLDataSet(ds1, "title");
var observer = { onPostUpdate: function(notifier, data) { var
a2 = new Spry.Widget.Accordion("Accordion1"); } };
Spry.Data.Region.addObserver("Accordion1", observer);
//-->
</script>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet"
type="text/css" />
</head>
<body>
<div id="Accordion1" class="Accordion" tabindex="0"
spry:region="ds1 dsTitles">
<div class="AccordionPanel" spry:repeat="ds1">
<div class="AccordionPanelTab" >{@name}</div>
<div class="AccordionPanelContent" >
<ul>
<li
spry:repeat="dsTitles">{dsTitles::title}</li>
</ul>
</div>
</div>
</div>
</body>
</html>
Please note that the forum frequently mangles code, so look
for "bad" tag names as well as wrapped JavaScript lines.
HTH
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert
Similar Messages
-
As I'm learning, I also am experiencing some difficulties.
I've tried to combine some XML data with an accordion. Since
the <div> solutions gave me errors, I found some inspiration
in the following
thread.
Can somebody help me and explain why this isn't working? (PS
I'm a newbie).
Some explanation what you might see in the code below:
- List view => ok = list generated from XML
- Manual Accordion => ok = HTML for the accordion
- Accordion from XML data => NOK = attempt to combine List
view and Manual Accordion =
Final goal
----------------------------------------Beginning of the
code----------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<title>00r05</title>
<!--Link the Spry libraries-->
<script type="text/javascript"
src="../Spry_1_6_1_022408/includes/xpath.js"></script>
<script type="text/javascript"
src="../Spry_1_6_1_022408/includes/SpryData.js"></script>
<script language="JavaScript" type="text/javascript"
src="../Spry_1_6_1_022408/includes/SpryNestedXMLDataSet.js"></script>
<script type="text/javascript">
var dsSubjects = new
Spry.Data.XMLDataSet("00r03_content.xml", "subjects/subject");
var dsSubSubjects = new
Spry.Data.NestedXMLDataSet(dsSubjects, "subsubject");
</script>
<!--Accordion-->
<script language="JavaScript" type="text/javascript"
src="../Spry_1_6_1_022408/widgets/accordion/SpryAccordion.js"></script>
<link
href="../Spry_1_6_1_022408/widgets/accordion/SpryAccordion.css"
rel="stylesheet" type="text/css" />
</head>
<body>
<!--
<div spry:region="dsSubjects">
<ol>
<li
spry:repeat="dsSubjects">{dsSubjects::name}</li>
</ol>
</div>
-->
<p>---------List View---------</p>
<div spry:region="dsSubjects dsSubSubjects">
<ul>
<li spry:repeat="dsSubjects">{name}
<ul>
<li
spry:repeat="dsSubSubjects">{dsSubSubjects::name}</li>
</ul>
</li>
</ul>
</div>
<p>---------Manual Accordion---------</p>
<div id="testAccordionManual" class="Accordion">
<ul class="AccordionPanel">
<li class="AccordionPanelTab">home</li>
<ul class="AccordionPanelContent">
</ul>
</ul>
<ul class="AccordionPanel">
<li class="AccordionPanelTab">Products</li>
<ul class="AccordionPanelContent">
<li>Product 1</li>
<li>Product 2</li>
</ul>
</ul>
<ul class="AccordionPanel">
<li class="AccordionPanelTab">Contact</li>
<ul class="AccordionPanelContent">
</ul>
</ul>
</div>
<p>---------Accordion from XML data---------</p>
<div id="testAccordionAuto" class="Accordion"
spry:region="dsSubjects dsSubSubjects">
<ul class="AccordionPanel">
<li class="AccordionPanelTab"
spry:repeat="dsSubjects">{dsSubjects::name}</li>
<ul class="AccordionPanelContent">
<li
spry:repeat="dsSubSubjects">{dsSubSubjects::name}</li>
</ul>
</ul>
</div>
<script>
var acc1 = new Spry.Widget.Accordion("testAccordionManual");
var acc2 = new Spry.Widget.Accordion("testAccordionAuto");
</script>
</body>
</html>
----------------------------------------Ending of the
code----------------------------------------quote:
Originally posted by:
V1 Fusion
Your missing a </li>
<li spry:repeat="dsSubjects">{name}
Many thanks. That seams the be the issue.
However, I'm not able to resolve it. After experimenting I've
noticed that either:
- I can get the </li> correct, but then the script
generates only the three panel tabs without the content
- or I have the issue with the </Li> as you explained
So the issue must be with the way I define my list. But I'm
missing something to get it right.
Help is more then welcome.
quote:
Originally posted by:
V1 Fusion
and uhm:
Did u check this example for your accordion data issues?
http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample2.html
Yes I did. I even managed to reconstruct it with my own data.
But what if you would like to see the 5 addresses of "Edward
Smith"? While working with this example I experienced a counter
issue. The example was not elaborative enough to be useful too me
(and a lot of others if you read trough this forum).
quote:
Originally posted by:
Idriel
Here you can se Accordation from XML and Nested DataSet. I
have all created.
http://zagreb-rugby.hr/igraci.html?id=seniori
Wow, impressive! I'll hope I manage to get as smart as you
are and built something just like that.
It took me a while before I got the concept. And you
explained it very well. The concept contains 2 kind of data sets,
one external and the other embedded.
I also tested it and it is a workaround. Unfortunately, as
I'm studying the AJAX and SPRY concepts, I want to see how far I
can go ... with as little as help and workarounds as possible.
That said, I of course welcome all help when needed, but I
need the challenge as well.
PS I'll hope you have a great rugby season with your team ;-) -
How to retrieve image from XML file
Hi All,
I am new to XML. So any best guidance is appreciated.
The application requirement is to display image retrived from uploaded xml file in file upload section of our application. And store that image in database.
In my XML file , images & strings & numbers & booleans are there . I am able to save everything in database except images .
I am using JSF, Seam & Hibernate combination. In my Hibernate entity class i took BLOB datatype for image.
I am using following tags in my Xhtml file to display image
<s:graphicImage value="#{hibernateentitybean.picBlobtype}" height="200" width="200">
<s:transformImageSize width="200" height="200" />
<s:transformImageType contentType="image/jpeg"/>
But image is not displayed in Xhtml file
I am using org.w3c.dom.Document for retrieving node name & corresponding value in that node in XML file.
I am getting code like below for Image when i am logging all values from XML files in my bean class .
x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl
I want to convert this value to image. So i can convert image to bytes and store in BLOB.
Can anyone guide me ? or any other approach .
Thanks in advance for any reply.
Regards,
NareshDan_Koldyr wrote:
agree, it's really odd. Just reread OP and it says:
NareshDharmiVatsal wrote:
want to convert this value to image. In any case it doesn't get worth then another single code line:
final String cdata = "x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl";
final sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
final byte[] data = decoder.decodeBuffer(cdata);
Blob blob = new SerialBlob(data);//or what ever other DB-specific blob implementaiton Did i answered original question? Any more comments to my first replay?I can comment on this latest code. The package sun.misc is private to Sun (Oracle now of course). It is undocumented and may change or be removed altogether in a future release. There is a good free open source Base64 decoder in the Jakarta Commons Codec library. -
How to send data one row at a time from xml to flex
I want to setTimerEvent while sending data from xml to flex, one row at a time.
I have attached the xml.
Thanks in advance.Hi Greg,
Thanks for the reply. You must have seen the xml which i have attached.Here is the .mxml code which i have written:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="accountData.send()">
<mx:Script>
<![CDATA[
import mx.controls.*;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
[Bindable]
private var AccountInformation:ArrayCollection;
private function AccountHandler(evt:ResultEvent):void
AccountInformation = evt.result.xml.AccInfo;
private function faultHandler(evt:FaultEvent):void
var faultMessage:String = "Could not connect with XML file";
Alert.show(faultMessage, "Error opening file");
]]>
</mx:Script>
<mx:HTTPService id="accountData" url="pgm1.xml" result="AccountHandler(event)" fault="faultHandler(event)" />
<mx:DataGrid x="20" y="24" width="950" dataProvider="{AccountInformation}" />
</mx:Application>
This reads and displays all the rows. But I want to display single row at a time with sometime time gap between the display of two consecutive rows.I am new to flex and this is my first code, so need your help on this.
I hope i have made myself clear. If there is anything else please let me know.
Looking forward to some solution.
Thanks in advance.
Regards,
praj58 -
How to upload the data from XML file to SAP database using IDOC
Hi,
I need some steps to upload data from XML format file from other directory to SAP database using IDOC.
how to approch this please if any one knows give me ans
it will be a great help ful to me
Thanks in Advance
MallikThank you vijay,
But i heard that by using this Fun modules, when we are passing IDOC in back ground schedule, so some other depended FM not supporting, so how to approach this and how to avoid this problem.
Have you worked on this before if any one worked on this please help me out
And thank you once again for your valuable information
Best Regards
Mallik -
How to remove an Element from XML by confirming Attribute of that element
Hi guys
I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
here is my XML file:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
</users>for example i want to delete a user which have user id= Guest.
How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
Waiting for your replay.
Thanks in Advance
Best regardHi,
Till now i tried the following code which give null pointer exception at following line
element.getParentNode().removeChild(element);
public String removeUserByID(String id) throws Exception{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer tFormer = tFactory.newTransformer();
doc = builder.parse(usersXml);
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
// Remove the node
element.getParentNode().removeChild(element);
// Normalize the DOM tree to combine all adjacent nodes
doc.normalize();
FileOutputStream fos = new FileOutputStream(this.usersXml);
XMLOutputter out = new XMLOutputter();
out.output(((org.jdom.Document)doc), fos);
/* Source source = new DOMSource(doc);
Result dest = new StreamResult(System.out);
tFormer.transform(source, dest);
System.out.println();
return "true";
if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
Best regards and thanks again 4 ur reply. -
How to parse contents from XML file in Java
Hi All,
I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
How to parse Contents of XML file??
Thanks in advance,
Rajendra.Hi All,
I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
How to parse Contents of XML file??
Thanks in advance,
Rajendra. -
How to create Inbound Idoc from XML file-Need help urgently
Hi,
can any one tell how to create inbound Idoc from XML file.
we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml' we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
Please let me know the process to trigger inbound Idoc with out using XI and any other components.
Thanks in advance
Dora ReddyHi .. Did either of you get a result on this?
My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
I see lots of mention of using a Function Module.
Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
Or is there something tht can be done with Standard SAP?
Thanks
Lee -
Hi I need this asap... "Java code to generate XML File from XML Schema"
Hi all....
I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
Thankz in advance...
PS: I already posted in the afternoon... this is the second posting.take look at :
http://sourceforge.net/projects/jaxme/
this might help... -
Java code to generate XML File from XML Schema
Hi I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
Thankz in advance...JAXB has been available as an early release download for some time. There are also XML Binding packages available from Borland (JBuilder) and Castor. These tools create Java classes from a source document, xml,dtd etc. You can use these classes to marshal-unmarshal XML documents.
Dave -
Porting data from Oracle8i to XML and from XML to Oracle 10g
Hai
I have a client database (using oracle 8i) and a server database (oracle 10g).
Due to lack of leased line connectivity i want to port these offline data from 8i to 10g
using a modem(dial up connection).Is there is any way to port data from 8i to XML
and from XML to 10g.
thanks in advance
dejiesThanks Nicolas,
As per documentation, it seems to be difficult for export/import from Oracle8i to 10g. Is that any way to achieve this? I have to append the newly imported data with old or exisiting data into Oracle10g.
Regards
Nikhil -
Hello,
I have designed a form in Adobe LiveCycle designer with rights enabled PDF,As we cant collect PDF directly from users due to 500 use licensing limit.Plan is to have users send the XML via 'Submit By Email' button and from my end recreate the PDF.
My question is whats the ways/options do i have to recreate the PDF based on values in XML.
This would be part of set up- where an application would connect to email server, download the email message with XML attachment;review the xml and if some tags/nodes are true then recreate the PDF file with data from XML and save it locally.
Now the email template have a statement that ". Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form....."
Does that mean I can simply import the XML file to the form I created and voila i have my PDF,but how can i achieve the same via an application.
As always Thanks in advance.You open the form in Acrobat and then simply use the data import under the forms tools. You could also use tools to save the data to a database (sorry, I don't know how to do it, but know it can be done).
-
Please help me in inserting data into table from XML message.
Hi Experts,
Please provide a procedure to implement my below requirement.
Since I am new to queue concept.
[code]- <MESSAGES>
- <MESSAGE ID="3026900">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
- <MSG>
- <WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="UPDATE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="3838" geo="AT" sku="A0814818" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="202" geo="GB" sku="A0814819" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814820" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="ADD" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814821" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814822" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="DELETE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814817" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814816" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>[/code]
The above XML message is receieved by our oracle queue.Once the message is receieved to our queue.
We have to process the message according to the action(UPDATE ADD DELETE).
From this message we have to process only 3 fields (geo sku lead_time).
These three feilds data should be processed into the SKU_LEAD_TIME table based on the action.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
[code]UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req2:
IF the action is delete then the records should be deleted from the "LEAD_TIME_TABLE" table.
based on the below condition.
[code]DELETE FROM LEAD_TIME_TABLE
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
INSERT INTO SKU_TABLE VALUES('A0814817','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814818','AT',30);
INSERT INTO SKU_TABLE VALUES('A0814819','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814820','BE',30);
INSERT INTO SKU_TABLE VALUES('A0814821','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO LEAD_TIME_TABLE_STAGING VALUES('A0814822','BE',30);[/code]
From the above message.
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
SKU GEO LEAD_TIME
A0814822 BE 30[/code]
Test case for req3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30
A0814822 BE 30[/code]
Please help me.
Thanks in advance.Hi,
I have resolved this issue.
But I have stuck up in implementing some of the scenarios.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "schema_name.SKU_TABLE" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the three parameter(GEO SKU LEAD_TIME) values from XML message and two fields MODEL,CLASS from SKU_TABLE
should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "schema_name.SKU_TABLE" table
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the four parameter(BUSINESS_UNIT_ID GEO SKU LEAD_TIME) values from XML message
should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "schema_name.SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of LEAD_TIME_TABLE_STAGING and "sid" of MAPPING table WHERE business_unit_id=sid.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(business_unit_id NUMBER,sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class VARCHAR2(10));
CREATE TABLE mapping(sid NUMBER,schema_name VARCHAR2(20));
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO SKU_TABLE VALUES('A0814817','M125','C111');
INSERT INTO SKU_TABLE VALUES('A0814818','M127','A111');
INSERT INTO SKU_TABLE VALUES('A0814819','M126','A111');
INSERT INTO SKU_TABLE VALUES('A0814820','N100','B111');
INSERT INTO SKU_TABLE VALUES('A0814821','P123','B111');
INSERT INTO mapping VALUES(202,'WEDB');
INSERT INTO mapping VALUES(2828,'HR');
INSERT INTO mapping VALUES(3838,'BB');
[/code]
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in schema_name.SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
BUSINESS_UNIT_ID SKU GEO LEAD_TIME
2828 A0814822 BE 30[/code]
Test case3.3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]INSERT INTO SKU_TABLE VALUES('A0814822','P123','B111');
SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
A0814822 P123 B111 GB 30[/code]
I am able to implement Req1 and Req3.1 for action UPDATE and INSERT in single merge statement.
However my code is not taking care of all my requirements.
Please find my below code.
[code] CREATE OR REPLACE PACKAGE BODY messg_values_process
AS
procedure ProcessInboundLtimeMessage(p_xml_message XmlType)
is
begin
for work_unit in (
select message.MESSAGE_ID
, work_unit.ACTION
, work_unit.LEADTIME_NODES
from XmlTable(
'/MESSAGES/MESSAGE'
passing p_xml_message
columns
MESSAGE_NO for ordinality
, MESSAGE_ID number path '@ID'
, WORK_UNIT_NODES XmlType path 'MSG/WORK_SET/WORK_UNIT'
) message
, XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/WORK_UNIT'
passing message.WORK_UNIT_NODES
columns
WORK_UNIT_NO for ordinality
, ACTION varchar2(10 char) path '@ACTION'
, LEADTIME_NODES XmlType path 'RECORDSET[@TABLE_NAME="LEAD_TIME"]/xml/rs:data/z:row'
) work_unit
LOOP
CASE work_unit.ACTION
WHEN 'ADD' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'UPDATE' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'DELETE' THEN RemoveData(work_unit.LEADTIME_NODES);
ELSE null;
END CASE;
END LOOP;
END ProcessInboundLtimeMessage;
procedure MergeData(p_leadtime_nodes XmlType)
is
begin
if (p_leadtime_nodes is not null) then
merge into LEAD_TIME_TABLE old
using(
select *
from XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/z:row[not(@business_unit_id=following-sibling::z:row/@business_unit_id)]'
passing p_leadtime_nodes
columns
ITEM_NO for ordinality
, BUSINESS_UNIT_ID number path '@business_unit_id'
, GEO varchar2(20 char) path '@geo'
, SKU varchar2(20 char) path '@sku'
, LEAD_TIME number path '@lead_time'
) NEW
ON (old.VK_UNIT = new.SKU
AND old.GEO=new.GEO)
when matched then update
set old.LEAD_TIME = new.LEAD_TIME
when not matched then INSERT
( old.VK_UNIT
, old.MODEL
, old.CLASS
, old.GEO
, old.LEAD_TIME
, old.COUNTDOWN
, old.LAST_UPDATED_DATE
values
( new.SKU
,'A123'
,'A1234'
, new.GEO
, new.LEAD_TIME
, 'N'
, sysdate
end if;
exception
when others then
LogDataError(
'MergeData Procedure Failed #: '||chr(10)||sqlerrm
, null
, null
END MergeData;
END messg_values_process;
/[/code]
Please help me.
Thanks. -
How to Pass values from XML to JSP??? Urgent Please Help me
Hi guys,
I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
Looking for ur favourable reply.
Thanks in advance,
Sridharin a servlet :
parse your xml file (see how at the end of the post) and
put the values you want in the request attributes
request.setAttribute("value1", value1);
...redirect to the jsp
in the JSP:
get the wanted attributes:
String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data
http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm -
Apply spry functions on data uploaded from xml?
Hi,
I am trying to "simplify" my personal pages so I have only 1
html page and everything else is taken from xml through spry
framework (guys ... I love it .. super work)
But currently I am stuck on one issue:
Step 1
I replace the html parts -> I just put the html code to
xml node inside CDATA and call spry:setrow
Step 2
I would like to use the spry:detailregion /
spry:repeatchildren in the code that is inside CDATA ... but here I
am not successful yet
Is this possible? Or can you give me some hint/other
direction (I woul love to stay with XML and do not want to use the
Tabs)
You can check it here
http://doma.princ.biz/test-ajax/index.html
- (it is slow) click on Hudba and you will see what I ment. The xml
is music.xml so you can check the structure.
Thank you very much for help.Hi,
little update - I put the "final" state together with using
the tabs - it is not best solution because the page reads lots of
data on the load. But it is the state I would like to reach by
using xml some how
http://doma.princ.biz/test-ajax/index-tab.html
See the left menu and the changes in the middle and on the
right side.
The menu Hudba and then the accordion works now.
Any idea how to get the same stuff without spry tabs?
Thank you very much
Jiri
(using spry 1.4 - do not know if 1.5 will be help
here)
Maybe you are looking for
-
Help, My iPad Doesn't Work On iOs7
I have neever been so unhappy with an upgrade as I am with iOs7. What a mess they made of everything. Why dod theyt have to re-invent the wheel? My Youtube doesn't work and surfing the internet went to a crawl. Can someone give me some advice on how
-
How to Print text in two main windows
For printing label have created two main windows on a page. calling function write_form In ABAP Program under do loop for two times. but program prints only one window. why is it so? how can i print text on two windows. do 2 times. COUNT = COUNT +
-
I got the Blue Screen-But Not After Installing Leopard
I have not installed anything recently. Except Quake 4 but haven't even run it yet. I Rebuilt my Permissions and Restarted and suddenly got the Blue Screen. I had to hold down the power button and reboot. This is the first time it's ever happened. Af
-
Buy Book doesn't work in iPhoto 6
I have completed a Photo Book. However, pressing Buy Book does nothing at all. I have bought Apple iPhoto books before without any problems. One-click ordering is enabled for my account in the Apple Store (heard this as one possible solution) and I h
-
Performance issues when using Smart View and Excel 2010
Hello, we are experiencing very slow retrieval times when using Smart View and Excel 2010. Currently on v.11.1.3.00 and moved over from Excel 2003 in the last quarter. The same spreadsheets in 2010 (recreated) are running much slower than they used t