How to binding an array in javaFx
Hello fellows,
im trying to bind an array in javaFx but is not possible...
i have a problem that, in my point of view, only can be solved with a bind array.
a create some components in the scene dinamicaly and in other component (a button) a have to get this componets in the button function to manipulate them
this components that is dinamicaly created sofer some updates and can be deleted too.
i create an array that i put this components and my button recived this array, coz the array is always null (the inicial status of the array)
becouse of this i need a bindig array...
how can i do that?
or, that is an other solution?
i can get all the components in the scene of only one type (my component created dinamicaly)?
Here is example of a simple painter app where array binding is used:
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.input.*;
import javafx.scene.shape.*;
var elements: PathElement[];
Stage {
title: "Simple Painter"
scene: Scene {
content: Group{
content: [
Rectangle{
width: 400
height: 300
fill: Color.WHITE
onMousePressed: function( e: MouseEvent ):Void {
insert MoveTo {x : e.x, y : e.y } into elements;
onMouseDragged: function( e: MouseEvent ):Void {
insert LineTo {x : e.x, y : e.y } into elements;
Path{
stroke: Color.BLUE
elements: bind elements
}
Similar Messages
-
How to bind arrays to PL/SQL stored procedure using OCI?
Hi,
We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
- We have a stored procedure called "GetVEPFindTasks" with the following interface:
PROCEDURE GetVEPFindTasks (
p_ErrorCode OUT NUMBER,
p_ErrorMsg OUT VARCHAR2,
p_RowCount OUT NUMBER,
p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
p_MaxTask IN NUMBER);
t_VEPFindTaskRecordTable is a record with the following entries:
TYPE t_VEPFindTaskRecord IS RECORD (
RTCID NUMBER,
TransNum NUMBER,
TransTimestamp VARCHAR2(20),
Pathname1 image_data.pathname%TYPE,
Pathname2 image_data.pathname%TYPE,
Pathname3 image_data.pathname%TYPE,
OperatorID operator.id%TYPE);
- Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
Thank's for all your help.
** Dannil Chan **As you said:
You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
thanks
email: [email protected] -
How to bind bar chart(columns) to array list object in c# win form
how to bind bar chart(columns) to array list object in c#win form
Hi Ramesh,
Did you want to bind list object to bar chart? I made a simple code to achieve binding list to bar chart.
public partial class Form0210 : Form
public Form0210()
InitializeComponent();
private void Form0210_Load(object sender, EventArgs e)
BindData();
public void BindData()
List<int> yValues = new List<int>(new int[] { 20, 30, 10, 90, 50 });
List<string> xValues = new List<string>(new string[] { "1:00", "2:00", "3:00", "4:00", "5:00" });
chart1.Series[0].Points.DataBindXY(xValues, yValues);
The links below might be useful to you:
# Data Binding Microsoft Chart Control
http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
# Series and Data Points (Chart Controls)
https://msdn.microsoft.com/en-us/library/vstudio/dd456769(v=vs.100).aspx
In addition, if I misunderstood you, please share us more information about your issue.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
How to bind each DataGrid column separately?
Good day fellow Flex developers!
Could you please help me out. I am trying to figure out how to bind each DataGrid column separately. I need to bind each column to a separate bindable array variable. Is there a dataProvider property for each DataGridColumn???
Thanks in advance,
Eugenehopefully nope
just imagine code complexity for that feature?
how would you think should behave DataGrid when you'll populate your separate arrays with variable items number each?
all you are able and should do is to build composite dataProvider source, join all your separate arrays into it, this is your responsibility.
If you feel this message answers your question or helps, please mark it respectively -
Hi Colleagues,
Could anyone please let me know How to Built an array Dynamically according to some input parameter and How can this array be binded to context.
Thanks & Regards
SwethaHi Swetha,
You can either use the way which is described above or use this approach.
1) Create a node in the context named dataNode with 2 attributes. these 2 attribtes will represent the attributes which you wanted to put in the 2 D array. In this case lets say: siteName and siteLink. These are 2 attributes.
2) Use the hashmap instead of array. Please note that I have again used the generics. Use following code:
HashMap<String, String> valueContainer = new HashMap<String, String>();
valueContainer.put("google", "www.google.com");
valueContainer.put("gmail", "www.gmail.com");
3) Create the node elements in the same way:
String siteName=null;
Strinv siteURL=null;
Iterator iter = valueContainer.keySet().iterator();
while (iter.hasNext()) {
key = (String) iter.next();
value = (String) valueContainer.get(key);
IPrivateTestView.IDataNodeElement element=wdContext.createDataNodeElement();
element.setSiteName(siteName);
element.setSiteURL(siteURL);
wdContext.nodeDataNode().addElement(element);
I hope this helps!! Please revert back in case you need any further help!
Thanks and Regards
Pravesh -
How to bind json model to List items?
Hi guys,
I'm following ui5 developer guide trying to build an application. The application has a list to which I want to bind a json model.
But I'm so confused by the binding path( absolute, relative):
Here's my json model:
var players =
"name": "aaron"
"name": "mike"
"name": "jone"
var playersModel = new sap.ui.model.json.JSONModel();
playersModel.setData(players);
sap.ui.getCore().setModel(playersModel,"all_players");
Here's what I did to bind the model to the list:
var playerList = new sap.m.List({
playerList.setModel(sap.ui.getCore().getModel("all_players"));
playerList.bindItems("",
new sap.m.StandardListItem({
title:"{/name}"
what's wrong with my code?
Can someone advice how to specify the binding path correctly?
What's the meaning about relative path and absolute path?Just figure out how to bind.
var playerList = new sap.m.List({
playerList.setModel(sap.ui.getCore().getModel("all_players"));
playerList.bindItems("/", //<- absolute path, normally followed by a property name of the model object, but for this case, the model is an array,
// so nothing follows, path is just one slash
new sap.m.StandardListItem({
title:"{name}" // <- the array objects have been bound to the list items, so specify a relative path
absolute path starts with slash: "/aaa/bbb"
it means the path starts from the top hierarchy of the model:
relative path starts with a name of a property. "ccc"
it means the path is relative to the absolute path, so the absolute path of this relative path is "/aaa/bbb/ccc" -
Is is possible to set up a Bind Variable array. If it is possible, how do you do it?
I want to set up an array of flags in one region on the page, and check those flags in another region on the page (report region). Any help is greatly appreciated.
SharonSharon,
I'm confused. You talk about visual elements on a page (array of flags) and then you somehow already know you want to treat this as bind variable array.
Can you describe what you're trying to achieve, and not so much how you want to acheive it?
Joel -
How to bind ProgressBar ?
Hello ,
I want to use ProgressBar to indicate progress how much data are downloaded ;
How to bind ProgressBar with property and then to setProgress() method with this property.You had two problems in your code. First, the input stream "bis" had already been closed by the time the Task ran, thanks to the try-with-resources block closing everything for you. Second, the updateProgress was always producing values that would result in -1 (or a negative number) being produced for the progress.
Instead, you should open the streams (try-with-resources) within the task, fully in the background thread. And, you should pass the raw values into updateProgress instead of trying to compute a value between 0 and 100, and just let the updateProgress method do it for you.
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
* @author idle
public class YourDownloader extends Application {
private final HBox hBox = new HBox();
private final VBox vBox = new VBox();
ProgressBar progress = new ProgressBar(0.01);
public static void main(String[] args) {
Application.launch(args);
@Override public void start(Stage primaryStage) {
primaryStage.setTitle("Your Dounloader");
Group root = new Group();
Scene scene = new Scene(root, 500, 250);
final TextField urlTextField = new TextField();
urlTextField.setPromptText("Add URL here");
urlTextField.setPrefWidth(scene.getWidth() - scene.getWidth() / 3);
Button btn = new Button();
btn.setText("Start Download");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
try {
startDownload(urlTextField.getText());
} catch (IOException ex) {
System.err.println("There is a IOException !!! : " + ex);
hBox.getChildren().addAll(urlTextField, btn);
hBox.setPadding(new Insets(10, 5, 5, 10));
hBox.setSpacing(20);
vBox.getChildren().addAll(hBox, progress);
root.getChildren().add(vBox);
primaryStage.setScene(scene);
primaryStage.show();
public void startDownload(final String stringUrl) throws IOException {
final Task<Void> task = new Task<Void>() {
@Override public Void call() throws Exception {
URL url = new URL(stringUrl);
String fileName = url.getFile();
fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
try (BufferedInputStream bis = new BufferedInputStream(url.openStream());
FileOutputStream fos = new FileOutputStream(fileName);
BufferedOutputStream bos = new BufferedOutputStream(fos, 1024))
// buffer of the downloaded data
byte[] data = new byte[1024];
int read = 0, totalRead = 0;
long contentLength = url.openConnection().getContentLength();
while ((read = bis.read(data, 0, 1024)) > 0) {
totalRead += read;
bos.write(data, 0, read);
updateProgress(totalRead, contentLength);
return null;
progress.progressProperty().bind(task.progressProperty());
new Thread(task).start();
} -
I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
1. Party (PartyId, Name)
2. Case (CaseId, CaseNo)
3. Petitioner (CaseId, PartyId) ............. Link Table
I am completely new to .Net and to begin with I download Microsoft's sample application and
following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
users can choose one from the dropdown list to add or edit the petitioner.Hello Barry,
Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
the sample available at the link you supplied.
To get the idea of the thing here is my code behind of a view vBoxPetitioner:
<UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:v="clr-namespace:CCIS.View.Case"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
d:DesignWidth="300"
d:DesignHeight="200">
<UserControl.Resources>
<DataTemplate DataType="{x:Type vm:vmPetitioner}">
<v:vPetitioner Margin="0,2,0,0" />
</DataTemplate>
</UserControl.Resources>
<Grid>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Margin="2">
<Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
| <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
</TextBlock>
</StackPanel>
</HeaderedContentControl.Header>
<ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
</HeaderedContentControl>
</Grid>
</UserControl>
This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
Here is the code of vmPetitioner, a ViewModel:
Imports Microsoft.VisualBasic
Imports System.Collections.ObjectModel
Imports System
Imports CCIS.Model.Party
Namespace CCIS.ViewModel.Case
''' <summary>
''' ViewModel of an individual Email
''' </summary>
Public Class vmPetitioner
Inherits vmParty
''' <summary>
''' The Email object backing this ViewModel
''' </summary>
Private petitioner As tblParty
''' <summary>
''' Initializes a new instance of the EmailViewModel class.
''' </summary>
''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
Public Sub New(ByVal detail As tblParty)
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Me.petitioner = detail
End Sub
''' <summary>
''' Gets the underlying Email this ViewModel is based on
''' </summary>
Public Overrides ReadOnly Property Model() As tblParty
Get
Return Me.petitioner
End Get
End Property
''' <summary>
''' Gets or sets the actual email address
''' </summary>
Public Property fldPartyId() As String
Get
Return Me.petitioner.fldPartyId
End Get
Set(ByVal value As String)
Me.petitioner.fldPartyId = value
Me.OnPropertyChanged("fldPartyId")
End Set
End Property
End Class
End Namespace
And below is the ViewMode vmParty which vmPetitioner Inherits:
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports CCIS.Model.Case
Imports CCIS.Model.Party
Imports CCIS.ViewModel.Helpers
Namespace CCIS.ViewModel.Case
''' <summary>
''' Common functionality for ViewModels of an individual ContactDetail
''' </summary>
Public MustInherit Class vmParty
Inherits ViewModelBase
''' <summary>
''' Gets the underlying ContactDetail this ViewModel is based on
''' </summary>
Public MustOverride ReadOnly Property Model() As tblParty
'''' <summary>
'''' Gets the underlying ContactDetail this ViewModel is based on
'''' </summary>
'Public MustOverride ReadOnly Property Model() As tblAdvocate
''' <summary>
''' Gets or sets the name of this department
''' </summary>
Public Property fldName() As String
Get
Return Me.Model.fldName
End Get
Set(ByVal value As String)
Me.Model.fldName = value
Me.OnPropertyChanged("fldName")
End Set
End Property
''' <summary>
''' Constructs a view model to represent the supplied ContactDetail
''' </summary>
''' <param name="detail">The detail to build a ViewModel for</param>
''' <returns>The constructed ViewModel, null if one can't be built</returns>
Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Dim e As tblParty = TryCast(detail, tblParty)
If e IsNot Nothing Then
Return New vmPetitioner(e)
End If
Return Nothing
End Function
End Class
End Namespace
And final the code behind of the view vPetitioner:
<UserControl x:Class="CCIS.View.Case.vPetitioner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
Width="300">
<UserControl.Resources>
<ResourceDictionary Source=".\CompactFormStyles.xaml" />
</UserControl.Resources>
<Grid>
<Border Style="{StaticResource DetailBorder}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Petitioner:" />
<ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
</Grid>
</Border>
</Grid>
</UserControl>
The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
what I need to Know is how to route the binding path if it exists in a different ViewModel?
Sir, I look forward to your early reply bringing a workable solution to the problem I face.
Warm Regards,
Arun -
Hello,
on my page I have 2 items:checkbox and text area. How to bind its work processes together? For example, when checkbox is checked then Text area is disable and when not then enable.
Thanks' for help.
Karina.hi karina--
this, too, is javascript question. please see my answer to your previous post...
Multiselect list (LOV)
...regards,
raj -
How to get slider window in javafx
How to get Slider window in javafx when we click on button slider window should open with sliding effect and when we clock on close button of slider window it should be close with sliding effect....plss send the link regarding this or if possible then plss send the code.Thanx inadvance
Have a look at the following samples, and if they are not what you are looking for, please post back with a more elaborate description of your issues and an sscce of what you have tried so far (even if it doesn't function as you want it to).
Experiments with Java: Sliding in JavaFX (It&#8217;s all about clipping)
Example of a JavaFX Pane which slides in and out on command. -
How to bind a UI element to the context
Hi Experts,
I have a problem binding UI element to the context. In my code i have to create TabStrips dynamically and under this tabstrip number of UI elements would be there. For this i have a code like this..
IWDTransparentContainer theActionContainer =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDTabStrip ts = (IWDTabStrip) view.createElement(IWDTabStrip.class,"TabStrip");
IWDTab tab1 = (IWDTab) view.createElement(IWDTab.class,"Tab1");
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
IWDCaption header1 = (IWDCaption) view.createElement(IWDCaption.class,"Header1");
header1.setText("Tab1");
tab1.setContent(in);
ts.addTab(tab1);
IWDTab tab2 = (IWDTab) view.createElement(IWDTab.class,"Tab2");
IWDInputField in2 = (IWDInputField) view.createElement(IWDInputField.class,"in2");
IWDCaption header2 = (IWDCaption) view.createElement(IWDCaption.class,"Header2");
header2.setText("Tab2");
tab2.setHeader(header2);
ts.addTab(tab2);
theActionContainer.addChild(ts);
<b>when i run this code it is giving following exceptions..</b>
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
... 63 more
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripItemContentFragment(TabStripRenderer.java:1867)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripFragment(TabStripRenderer.java:838)
From these exceptions what i understood is, i need to bind these UI elements to context.
Can any body tell me how to bind a UI element to the context if I understood the exceptions correct..
Thanks in Advance,
Murthy.HI,
lets say Ctx is your context attribute,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getAttribute("Ctx");
then , as per your code,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
if your contex attribute is child of some other node then do like this,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getChildNode("SalesOrder",0)getAttribute("Ctx");
//this is when Ctx is child of node SalesOrder, and we are taking Ctx from its 0th element
then ,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
include this in your code ,
let me know if you face any problem
regards
reward points if it helps -
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; -
How to bind JtextFields in Swing to Table fields in the database
Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
Am really new to java programming and have interest in learningThe standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started. -
How to bind "Image Field" object on a database
Hi to all
I inserted into a dynamic PDF (Livecycle ES3 trial) an image field, but I don't understand how I can to bind a JPG into a database.
In (F5) preview... I'm able to open a image file on filesystem and visualize it on PDF form... but then? How to bind on database?
In my several tentatives I'm using a MS Access 2010 database table, where I defined a OLE object... but doesn't work.
Thank you at all.
visertHi,
I have not tried to do this, but this document provides some instructions.
http://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdfhttp://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdf
Hope it helps
Bruce
Maybe you are looking for
-
Restriction on BEX gives medium description
Hi Experts, I made a user entry variable on Info object in the bex. The variable can be changed in query navigation and has a default value. When I open the query the default value exhibit is medium description and in the selection filter value I get
-
Installscript engine error message
HELP. I Have an ipod shuffle which came with itunes. I have an older version of itunes loaded. I want to upgrade to "7" version but during the install I get the following message: The install script engine on this machine is older than required to ru
-
Hi, I have created a SAP Query with 3 tables AUFK, COEP and PA0001. The selection contains the orderno. from AUFK (=base table), company code, year and period from COEP. The display contains orderno. personnelno., name, quantity hours and costs, docu
-
Importing Data from Foxpro 2.5 dbfs
Hi I would like to know as to whether there are any plugins available to import data from foxpro dbfs int o Oracle 8i. Incase they dont exist, then HOW DO I IMPORT DATE FROM FOXPRO TABLES ? Please revert with solutions. Thanks
-
Why some extra XML tags are created when viewed a XML in Adobe Illustrator with Esko plugin?
We see some extra XML tags are created when viewing a XML in Adobe Illustrator with Esko plugin. Why these extra lines are created ? Screenshot of XML and XML viewed in AI below(the extra XML tags outlined in red):