Dynamic variable and/or XML LazyLoader HELP
I am loading images via xml lazyloader into my air app
I need var b to be "img" + item.id dynamically
any ideas???
for each (var item : LoadingItem in lazy.items)
var b : Bitmap = lazy.getBitmap(item.id);
addChild(b);
If you dont know the lazyloader code then can you please explain how to create a dynamic variable for a bitmap???
so i should set type here
var img:bitmap = {}
then create the variable like this in my for statement?
img[this[item.id]] = lazy.getBitmap(item.id);
lets say item was 1,2,3
Then
img[1]
img[2]
img[3]
would be able to hold a different bitmap
thanks in advanced
Similar Messages
-
Dynamic Variables and New-Object - in a GUI
so, i have not found anything that i can parlay into a solution for what i am attempting to do.
Basically i am using powershell to build a GUI to manage websites on various servers.
in a nutshell:
- i have an array with the servers i want to query
- a foreach loop gets me the site names for each server (number of sites can vary on a server).
- need put checkboxes on a GUI for every site to do something (25-30 sites across 8 servers).
currently i am passing the $dir.name variable to a function that will create the new variable using this command:
$pName = $dir.name New-variable -name $pName -value (New-Object System.Windows.Forms.CheckBox)
$pName.Location -value (New-Object System.Drawing.Size(10,$i))
$pName.Size -value (New-Object System.Drawing.Size(100,20))
$Pname.Text -value $dir.name
$groupBox.Controls.Add($pName)
Problem is i am not able to do anything with my newly created variable. I am trying to use the following code to position the new checkbox but i get nothing (same for text, size, etc.) I am not seeing any errors, so i don't know what i have going
wrong.
is this even possible?
I am able to create static checkboxes, and i can create dynamic variables. But i can't mix the two...Here is how we normally use listboxes to handle form situations like this one. The listboxes can automatically select subgroups.
The hash of arrays can be loaded very easily with a script or the results of the first list can be used to lookup and set the contents of the second.
Notice how little code is actually used. This is all of the setup code needed aside from the from definition:
$FormEvent_Load={
$global:serversToSites=@{
Server1=@('S1_SITE1','S1_SITE2','S1_SITE3')
Server2=@('S2_SITE1','S2_SITE2','S2_SITE3')
Server3=@('S3_SITE1','S3_SITE2','S3_SITE3')
$listbox1.Items.AddRange($serversToSites.Keys)
$listbox1_SelectedIndexChanged={
$listbox2.Items.Clear()
$listbox2.Items.AddRange($global:serversToSites[$listbox1.SelectedItem])
$listbox2_SelectedIndexChanged={
[void][System.Windows.Forms.MessageBox]::Show($listbox2.SelectedItem,'You Selected Site')
Here is the complete demo form:
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$listbox2 = New-Object 'System.Windows.Forms.ListBox'
$listbox1 = New-Object 'System.Windows.Forms.ListBox'
$buttonOK = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$FormEvent_Load={
$global:serversToSites=@{
Server1=@('S1_SITE1','S1_SITE2','S1_SITE3')
Server2=@('S2_SITE1','S2_SITE2','S2_SITE3')
Server3=@('S3_SITE1','S3_SITE2','S3_SITE3')
$listbox1.Items.AddRange($serversToSites.Keys)
$listbox1_SelectedIndexChanged={
$listbox2.Items.Clear()
$listbox2.Items.AddRange($global:serversToSites[$listbox1.SelectedItem])
$listbox2_SelectedIndexChanged={
[void][System.Windows.Forms.MessageBox]::Show($listbox2.SelectedItem,'You Selected Site')
$Form_StateCorrection_Load=
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
$form1.Controls.Add($listbox2)
$form1.Controls.Add($listbox1)
$form1.Controls.Add($buttonOK)
$form1.AcceptButton = $buttonOK
$form1.ClientSize = '439, 262'
$form1.FormBorderStyle = 'FixedDialog'
$form1.MaximizeBox = $False
$form1.MinimizeBox = $False
$form1.Name = "form1"
$form1.StartPosition = 'CenterScreen'
$form1.Text = "Form"
$form1.add_Load($FormEvent_Load)
# listbox2
$listbox2.FormattingEnabled = $True
$listbox2.Location = '237, 26'
$listbox2.Name = "listbox2"
$listbox2.Size = '120, 134'
$listbox2.TabIndex = 2
$listbox2.add_SelectedIndexChanged($listbox2_SelectedIndexChanged)
# listbox1
$listbox1.FormattingEnabled = $True
$listbox1.Location = '13, 26'
$listbox1.Name = "listbox1"
$listbox1.Size = '120, 134'
$listbox1.TabIndex = 1
$listbox1.Sorted = $true
$listbox1.add_SelectedIndexChanged($listbox1_SelectedIndexChanged)
# buttonOK
$buttonOK.Anchor = 'Bottom, Right'
$buttonOK.DialogResult = 'OK'
$buttonOK.Location = '352, 227'
$buttonOK.Name = "buttonOK"
$buttonOK.Size = '75, 23'
$buttonOK.TabIndex = 0
$buttonOK.Text = "OK"
$buttonOK.UseVisualStyleBackColor = $True
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
$form1.ShowDialog()
You can easily substitute CheckedListbox if you like checkboxes.
¯\_(ツ)_/¯ -
How to Read and Write .XML datas (HELP Plz...)
hai everybody
how to read and write xml datas... plz give clean and simple example..
bcoz me want to produce such type of module...
if any one help me .. thats the only way me laid in software ladder
plz....
thank u in advancethank u for giving idiot..
but before posting i search in google also..
but i cant get what me expect..
thus i posted...
then who is ................?
sorry javacoder01
// plz help me
Message was edited by:
drvijayy2k2 -
Dynamic Forms and Flowing subforms -- Need help/Advice
Hello All -
I am creating a form for instructors at our college to complete. It has 3 pages, some static text, some required drop-down boxes, and three "comment" type areas which I would like to create so that they "flow" and display the entire contents when printed.
I've read everything I could find so far, but I think I am missing something quite basic.
I've created master pages, with a content subform on each one. I've placed all my content into subforms under that main content subform, named and ordered them the way they need to be. Most of it should appear as positioned. Only where there is one of the comment sections do I want/need the "flow content" option.
I tried following the directions I found in another thread. If I set the subform with the comment area to flow, then I never get the page break option (and it is needed) - it's always grayed out. When I try to set the underlying subform on the page to 'flow content', ALL of the content from all three pages ends up on one page, everything on top of each other.
What am I doing wrong?
Can anyone give me some tips as to where at least to start looking for what I've not done or done wrong?
Thanks in advance for any information -- it will be soooo appreciated!
LaurenHi Lauren,
You only need one Master page, and there's no need to put anything on it unless you want a header/footer that repeats on each page.
If you want to have things flow from page to page, create one body page object, and set its content type to Flowed (the body page is itself a subform). In it you put subforms with text, fields, and so on in them. Since your form will spill from page to page based on how much text the instructors type into the expandable comments fields, break up the forms content into sections (subforms) such that the layout can break between the subforms without taking away from the readability. These subforms should have a content type of Position. Even though there's only one body page object in your design, since you have three pages worth of stuff, it will spill onto three pages.
Now for the comments fields, which you want to wrap and expand. Make sure that each of your comments fields is in its own subform. Set the field to allow multiple lines and, in the layout tab, click the box to Expand to Fit (height). For the subform that contains the comments field, set the height to auto-fit (layout tab). Also for the subforms that contain comments fields, experiment with the "Allow Page Breaks Within Content" checkbox on the Subform tab. If you expect an instructor to blab on for more than an entire page of text, you will have to select this box, but otherwise I suggest leaving it unselected so that the entire comment remains together.
Jared Langdon
www.jlangdon.ca -
Query with dynamic variables and customised caption
How to change the Field label when the query asking dynamic values during the execution?
for example: in where condition i want to give a country name during the query execution, but in the small window it will display as 'Name' which is a country name. i want to display it as 'Country Name' which should be more readable for the end user. How can we achieve this?
Thanks
SV ReddyHi,
Unfortunately, it is not possible to change the system field description.
Refer to this thread
Re: Parameter Display Name Reg.
Regards,
Vijay Kumar
SAP Business One Forums Team -
AS2 syntax and dynamic variable names
Hi all,
Trying to learn AS2 and hoping someone can help me by
explaining the problems with the following sample code and what
would be needed to make it work (i.e. to create dynamic variables
and movie clips from an array).
Thanks for your time!kglad: Thanks for the super-quick and tremendously helpful
response! Much appreciated!
A couple of quick follow-up questions:
kglad wrote that "createEmptyMovieClip() returns a reference
to the created movieclip".
How would I use/access this reference?
Also, in the updated code below, I have two issues:
1. rolling over a movie clip yields "this is button
undefined" rather than "this is button a" for example; and
2. clicking on a movie clip outputs the result of the trace
command for all four clips (in reverse order) rather than just the
one clicked.
Any insights into what I need to do differently? Thanks
again! -
i have two dynamic variables latest week,latest week-1
when i am applying the filter condition: between latest week and latest week-1
(latest week,latest week -1 both are dynamic variables)
if i click on result it's showing no resultent data for current applied fiter
thanks
bethamsettyPlease Conform below steps.
The variable name is latestweek-1 ?
Please test dynamic variable in IntBlock whether are getting value or not? -- Do you know how to test variable in intblock.., If yes check first result.
Please follow the my blog and recreate new dynamic variable and follow the steps.
Note: Did you get any error?
Hope this help's
Thanks,
Satya -
Creating a dynamic variable in bpel process
hi
I have a requirement i.e. how to create a dynamic variable in bpel process?
Help me out with this....thanks.Open your bpel and look for and icon that looks like this... (x)
http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/bp_gsbpel.htm#CIADACJJ -
About "method", "instance variable" and "constructor"
Does a method need to be initialise?? if yes, how to write the code?
for example,is it:
public String mymethod( String args[]); ?
public double mymethod2 (); ?
what is the meaning of "instance variable" and "constructor"?
Please help.....THANKS!Previously posted to this OP:
Read the Java Tutorial: Learning the Java Language.
http://java.sun.com/docs/books/tutorial/java/index.html
� {� -
Dynamic variable names and invalid_character_err
I'm neither an expert at structure notation nor dynamic
variable naming conventions and would appreciate any help with the
following. Thanks!
This code works fine.
<cfset idx="123">
<cfset form.product[idx]=StructNew()>
<cfparam name="form.product[idx].product_nm"
default="Raspberry Jam">
<cfform name="data_entry" method="post" format="flash"
height="525" width="675" action="formdump.cfm">
<cfformgroup type="tabnavigator" height="400"
width="650">
<cfformgroup type="page" label="Product #idx#">
<cfinput name="static_form_name" type="text"
label="Product" value="#form.product[idx].product_nm#" height="350"
width="600" readonly="yes">
</cfformgroup>
</cfformgroup>
</cfform>
The following code results in the following error:
"ORG.W3C.DOM.DOMEXCEPTION ERROR. Message: INVALID_CHARACTER_ERR: An
invalid or illegal XML character is specified." The only change is
in the "name" attribute of the <cfinput> tag:
<cfset idx="123">
<cfset form.product[idx]=StructNew()>
<cfparam name="form.product[idx].product_nm"
default="Raspberry Jam">
<cfform name="data_entry" method="post" format="flash"
height="525" width="675" action="formdump.cfm">
<cfformgroup type="tabnavigator" height="400"
width="650">
<cfformgroup type="page" label="Product #idx#">
<!--- Change value of name attribute from
"static_form_name" to "product[idx].product_nm" --->
<cfinput name="product[idx].product_nm" type="text"
label="Product" value="#form.product[idx].product_nm#" height="350"
width="600" readonly="yes">
</cfformgroup>
</cfformgroup>
</cfform>
Pam Grieger
[email protected]Thanks for the info. Knowing what WON’T work is
helpful!
Here’s what I’m trying to do. I’m rewriting
one of my apps, switching out conventional HTML form controls for
<cfform> controls in Flash format. Many of the existing forms
in my app are for updating data contained in a central database.
When such a form is rendered to the screen, each form control is
pre-populated with existing data. All form controls are named
dynamically based upon the unique ID of the record being updated.
Here’s a streamlined but typical example:
<!--- User selected projects 14, 15, 16, and 17 for
update. Get existing project data. --->
<cfquery name="get_project_detail"
datasource="#application.DataSource#">
SELECT project_oid_nbr, project_nm
FROM project_table
WHERE project_oid_nbr IN (14,15,16,17)
ORDER BY project_oid_nbr
</cfquery>
<!--- Initialize the project_nm form control. Form names
are dynamic, based upon get_project_detail.project_oid_nbr. --->
<cfloop query="get_project_detail">
<cfparam name="form.project_nm_#project_oid_nbr#"
default="#get_project_detail.project_nm#">
</cfloop>
<!--- Create HTML form control. --->
<table>
<cfloop query="get_project_detail">
<tr>
<td>
<cfoutput>
Project #project_oid_nbr#:
<input type="text" name="project_nm_#project_oid_nbr#"
value="#Evaluate("form.project_nm_#project_oid_nbr#")#">
</cfoutput>
</td>
</tr>
</cfloop>
</table>
This has been working just fine. However, I’m wondering
if using the Evaluate() function is the most efficient way to go.
Therefore I wanted to use structure notation to avoid the
Evaluate() function, but as mentioned in my original post, this
naming convention won’t work with <cfform> tags.
Any suggestions as to the most efficient way to get the same
result while still using <cfform> tags? Thanks so much! -
Reading XML file into Dynamic Node and Display its output as Table.
Hi All,
Following is the output of XML file:
<Company>
<Employee>
<Name>John</Name>
<Age>23</Age>
<***>Male</***>
<Location>Frankfurt</Location>
</Employee>
<Employee>
<Name>Tina</Name>
<Age>21</Age>
<***>Female</***>
<Location>Boston</Location>
</Employee>
<Department>
<Name>Sales</Name>
<HQ>Chicago</HQ>
<Emplyoees>2300</Employees>
</Department>
I'm able to read the output through DOM parser. But How do I convert this into dynamic node and display this in Web dynpro as Table?
Any pointers in this regard will be great help?
Thanks
SrikantHi Maksim,
I've used your example and its now helping as there is kind of agreement on that I'll be knowing the structure of Xml and I can fill the nodes.
But suppose if you have Xml has following structure :
<?xml version="1.0" encoding="utf-8"?><DATA>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CONTRACT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CREDIT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">EMPRESS</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PAYMENT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PRICE</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
</DATA>
How we will do in this case?
Can we have something similar using DOM? Also what is the best method for displaying data being sent in form of XML. And generalize it for cases like this.
Thanks
Srikant -
Dynamic variable value based on a value from xml
I have a invoice template and it is for 4 different companies in my organization. Based on the organization I need to have a different value for a variable that adds blank lines to the end of the invoice. Is there anyway to assign a value to variable based on the value of a xml tag.
ThanksI should have explained better before. I have one invoice template and we want to keep it one template for all companies. Each invoice is run individually, each companies footer is different, I am calling multiple headers and footers based on each company. Since the headers and footers are different I need to be able to add different amounts of lines and the end of each invoice depending on that company. I have accounted for the page break in my logic based on the amount lines the page is long. I just need a dynamic variable that I can assign different values on the fly.
Thanks -
Diff betwn Substitution and Dynamic Variable
Hi All,
As I'm new in hyperion planning I'm not able to figure out the difference between Substitution and Dynamic user variable. does anyone have any explanation with an example.. :(Hi,
Substitution variables act as global placeholders for information that changes regularly.
Each variable has a value assigned to it that can be set and changed centrally on the Analytic Services server at any time. When you are creating a substitution variable it depends on the requirement that variable is going to used for all application and its database or for particulaer apllication and its databases.
Substitution variables are especially useful when you are developing and reporting on rolling forecasts.
You can also use substitution variable in web form , business rules.
Substitution variable is created in Essbase but from 11.1.2.2 we can create substitution variable from workspace.
There is nothing named as Dynamic User variable. If i am not wrong you are asking about user variable.
User variables act as filters in data forms, enabling planners to focus only on the members they are interested in, such as departments in a particular division. Before you can associate a user variable with a data form, you must create the user variable.
User variable can increase performance by helping planners focus on certain members.
It is available in the File -> New -> User variable. It is also available in the Administration -> Manage -> User Variable.
Hope this helps.
Regards
SST.....
Edited by: ss1988 on Mar 1, 2013 2:14 AM
Edited by: ss1988 on Mar 1, 2013 2:16 AM -
Sql:variable and XML query performance
Can someone help with sql:variable() in xml queries? It seems that when I attempt to reference variables with the sql:variable(...) function in an xpath function (exist or nodes) it comes up with a totally different query plan, possibly ignoring
my secondary indices like the ones for VALUE, PATH.
But if I replace sql:variable("@p_ObjectIdentifierForReference") with the literal (ie. "ord/p/ord0616.p") then it uses secondary indices more consistently.
Below you will see an unsuccessful attempt to get the query to "OPTIMIZE FOR" a specific literal value of @p_ObjectIdentifierForReference. But this doesn't give work. It doesn't give me a plan using the secondary index I expect.
Ideally there would be a way to get the sql:variable(...) function to give the same query plan as a literal. Not sure why that isn't the default behavior.
DECLARE
@p_ObjectIdentifierForReference
varchar(500);
SET
@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p';
WITH
XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004'
as D)
SELECT
XREF_FileDataReference.XREF_FileData
AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]',
'int')
AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]',
'int')
AS LineNumber
FROM
(SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.')
AS InnerRowNode
FROM
XREF.XREF_FileData
OUTER APPLY
DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference")
and @Reference-type = "RUN"]')
as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier
= sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]')
= 1)
AS XREF_FileDataReference
INNER
JOIN XREF.XREF_MemberBuilt
ON XREF_MemberBuilt.XREF_FileData
= XREF_FileDataReference.XREF_FileData
INNER
JOIN XREF.XREF_FileEntry
ON XREF_FileEntry.XREF_FileEntry
= XREF_FileDataReference.XREF_FileEntry
WHERE
XREF_MemberBuilt.XREF_ProjectBuilt
= 69
OPTION(RECOMPILE,
OPTIMIZE FOR (@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p')I tried to create a "repro" of your query so we can work on it and try and improve it, but I got the best results by just adding text() and [1] to it, eg
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
In my main repro, even with a large piece of xml with 100,000 elements, there still wasn't much difference between the queries:
USE tempdb
GO
IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = 'XREF' )
EXEC( 'CREATE SCHEMA XREF' )
GO
IF OBJECT_ID('XREF.XREF_FileData') IS NOT NULL DROP TABLE XREF.XREF_FileData
CREATE TABLE XREF.XREF_FileData
rowId INT IDENTITY,
DataXref XML,
XREF_FileData INT,
XREF_FileEntry INT,
CONSTRAINT PK_XREF_FileData PRIMARY KEY ( rowId )
GO
IF OBJECT_ID('XREF.XREF_MemberBuilt') IS NOT NULL DROP TABLE XREF.XREF_MemberBuilt
CREATE TABLE XREF.XREF_MemberBuilt
XREF_ProjectBuilt INT,
XREF_FileData INT
GO
IF OBJECT_ID('XREF.XREF_FileEntry') IS NOT NULL DROP TABLE XREF.XREF_FileEntry
CREATE TABLE XREF.XREF_FileEntry
XREF_FileEntry INT
GO
-- Create larger piece of xml for repro
;WITH XMLNAMESPACES ( DEFAULT 'uri:schemas-progress-com:XREFD:0004' ), cte AS (
SELECT TOP 100000 ROW_NUMBER() OVER ( ORDER BY ( SELECT 1 ) ) rn
FROM master.sys.columns c1
CROSS JOIN master.sys.columns c2
CROSS JOIN master.sys.columns c3
INSERT INTO XREF.XREF_FileData ( DataXref, XREF_FileData, XREF_FileEntry )
SELECT
SELECT
CASE rn WHEN 9999 THEN 'ord/p/ord0616.p' ELSE CAST( rn AS VARCHAR(20) ) END AS "@Object-identifier",
'RUN' AS "@Reference-type",
SELECT
rn AS "File-num",
rn * 10 AS "Line-num"
FOR XML PATH(''), TYPE
) AS "*"
FROM cte
FOR XML PATH('Reference'), ROOT('Source'), TYPE
).query('<Cross-reference xmlns="uri:schemas-progress-com:XREFD:0004">{.}</Cross-reference>'), 1, 100
INSERT INTO XREF.XREF_FileEntry ( XREF_FileEntry )
VALUES ( 100 )
INSERT INTO XREF.XREF_MemberBuilt ( XREF_ProjectBuilt, XREF_FileData )
VALUES ( 69, 1 )
GO
--SELECT * FROM XREF.XREF_FileData
--SELECT * FROM XREF.XREF_FileEntry
--SELECT * FROM XREF.XREF_MemberBuilt
--GO
-- Add primary XML index
CREATE PRIMARY XML INDEX xidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
GO
-- Add value, property and path xml indexes
CREATE XML INDEX xvalidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR VALUE
CREATE XML INDEX xpthidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PATH
CREATE XML INDEX xprpidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PROPERTY
GO
:exit
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]', 'int') AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
So I guess I'm saying I cannot reproduce your problem on SQL 2008 R2 or SQL 2012. Does anything about this repro stand out as different from your situation?
Looking at your query I would say you might consider the following:
are you really seeing big differences in query duration?
pretty much ignore estimated plan costs for xml queries
consider breaking it up; eg carve off the xml then do the joins? If poor cardinality estimation is part of the problem this might help
Understand what PATH, PROPERTY and VALUE are for, then only create the ones you need
do you really have the range of queries that requires all three?
this is still a great article on xml indexes:
http://technet.microsoft.com/en-us/library/ms191497.aspx
What's performance like with the primary xml index only?
If performance is that important, consider materialising the columns permanently
I think the buffer_descriptors stuff is a distraction - mostly your cache is warm right?
plan forcing could be a last resort
Selective XML indexes in SQL 2012 onwards are great : ) much less storage required for example but much more specific -
Php variable and xml processing
Hello there,
I have a problem that is driving me crazy! I have a php file
which creates an xml string from a sql query. The problem is that I
need to use a variable from an swf file to create the query. All
this should happen when i click a button on the swf page. The xml
file is created no problem but the variable is not used. i am well
able to use these POST variables in other php files. As you can see
the php file is called twice in the action script. Is this the
problem. The line: xmlData.load("get_max_sess.php"); is fine. I
stuck the other on one in - loadVariablesNum ("get_max_sess.php",
0, "POST"); after the fact and this doesn't work. is there a
confilct in calling the same file twice? Is the sendAndLoad
function an option? Also included below is my php file.
Thanks so much. I really hope you can help me!
****************************************************ACTION
SCRIPT**********************************
call_btn.onRelease=function(){
function processXMLData(success)
{loadVariablesNum ("get_max_sess.php", 0, "POST");
if (success)
var rootNode=this.firstChild;
var contentNode=findNode(rootNode, "guit_vol");
guitVol=getValue(contentNode);
var authorNode=findNode(rootNode, "guit_pan");
guitPan=getValue(authorNode);
var contentNode=findNode(rootNode, "guit_vis");
visGuit=getValue(contentNode);
_root.guitVis.gotoAndStop(visGuit);
//assign xml info to musician objects
_root.guitObj.drag._y=guitVol;
_root.guitObj.drag._x=guitPan*2;
else
content="Today's news is not found";
function getValue(node)
if (node && node.firstChild)
return node.firstChild.nodeValue;
return "";
function findNode(node, nodeName)
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes &&
i<node.childNodes.length; i++)
var foundNode=findNode(node.childNodes
, nodeName);
if (foundNode!=null)
return foundNode;
return null;
var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;//when xml data loads the
function at the top executes
xmlData.load("get_max_sess.php"); //loads the xml data from
this location
stop();
****************************************************PHP
FILE**********************************
<?php
$user_id=$_POST['user_id'];
// query database for records
$connection = mysql_connect('localhost', 'm27849_martin',
'Geraldine1') or die ("Unable
to connect!");
mysql_select_db('m27849_liveroom') or die ("Unable to select
database!");
$query = "
SELECT a.guit_sess_id, a.guit_vol, a.guit_pan, a.guit_vis,
b.bass_sess_id, b.bass_vol, b.bass_pan, b.bass_vis, c.drum_sess_id,
c.drum_vol, c.drum_pan, c.drum_vis
FROM guit_info a, bass_info b, drum_info c, users_sessions d
WHERE d.session_id =(SELECT max(a.session_id) FROM
users_sessions a WHERE a.user_id = '$user_id')
AND a.guit_sess_id = d.session_id
AND b.bass_sess_id =a.guit_sess_id
AND c.drum_sess_id = b.bass_sess_id
//(SELECT userid from auth WHERE username ='martin')
//here a variable could be inserted to call the relevant row
(session)
$result = mysql_query($query) or die ("Error in query:
$query. " .
mysql_error());
$doc = new DomDocument('1.0');
//The first element we create in the XML document is known as
the root element. Each XML document must have 1, and only 1, root
element. In this example I have called it 'root', but you can use
whatever name you like (such as the name of the PHP script which is
executing). Note that you have to create the element and insert it
into the document with two functions.
// create root node
while($row = mysql_fetch_assoc($result)) {
$user = $doc->createElement('session');
$user = $doc->appendChild($user);
foreach ($row as $fieldname => $fieldvalue) {
//Note that here I create a new element for the field and
then insert it as a child to the current database row, as
identified in $occ.
$child = $doc->createElement($fieldname);
$child = $user->appendChild($child);
//Now I must add the field value as a text node, then insert
it as a child element to the current field node, as identified in
$child.
$value = $doc->createTextNode($fieldvalue);
$value = $child->appendChild($value);
//These loops do not terminate until they have processed
every column of every row which has been retrieved from the
database.
} // foreach
} // while
echo $doc->saveXML();
//echo $doc->saveXML($child);
mysql_close($connection);
//from:
http://www.tonymarston.net/php-mysql/dom.html
?>Hi there,
I cracked it after a lot of to-ing and fro-ing! Apparently
you CAN send a variable and then load xml. Thanks so much for your
advice and interest. I am much obliged.
Marty Party
Check out my code below....
user_id=147;
submit_button.onRelease=function(){
function processXMLData(success)
if(success)
{_root.status_id="Success"
var rootNode=this.firstChild;
var contentNode=findNode(rootNode, "guit_vol");
guitVol=getValue(contentNode);
var authorNode=findNode(rootNode, "guit_pan");
guitPan=getValue(authorNode);
var contentNode=findNode(rootNode, "guit_vis");
visGuit=getValue(contentNode);
status_id=visGuit;
etc....
else
content="Today's news is not found";
function getValue(node)
if (node && node.firstChild)
return node.firstChild.nodeValue;
return "";
function findNode(node, nodeName)
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes &&
i<node.childNodes.length; i++)
var foundNode=findNode(node.childNodes
, nodeName);
if (foundNode!=null)
return foundNode;
return null;
var xmlData=new XML();
xmlData.ignoreWhite=true;
xmlData.onLoad=processXMLData;
//xmlData.load("get_max_sess.php");
var id:LoadVars = new LoadVars();
id.user_id = user_id;
//id.username = _root.username;
id.sendAndLoad("get_max_sess.php", xmlData, "POST");
Basic idea from
http://www.permadi.com/tutorial/flashXMLNewsExample/index.html
- Thank you!!
Maybe you are looking for
-
Using keypad on wireless keyboard to enter passwords won't work in safari
I have an iMac and I am using an apple wireless keyboard. Whenever I try and type in a password that has numbers in it and I use the keypad, the password is not recognized. I do not have the mouse function turned on. The keypad works fine in all othe
-
In Material Forecast what is the Basic Value? How is it calculated in the system for a constant Model selection for forecasting?
-
Hello, I'm not really good with network stuff, so I know very little about my problem here. I'm working on an offshore drilling rig and they've recently set up a wi-fi system for personal use. It's very slow and governed by the nanny Websense. I know
-
Change background with rollover?
Not sure if it can be done (maybe a different way than I'm trying to figure out), but my goal is to have an image that fills the entire window, even if it's resized. Then, when you rollover a menu option, the image will change to a different photo.
-
Truncate Table after 20 rows?
Hi there! Is it possible to truncate a table after 20 rows? (Has it something to do with ROWNUM?)