Help in retreiving database data using a loop
Hi, new here, please help me with my problem.
In my database table, (SQL) I have 2 coloumns AgtName and Tier1.
Within this table there are these data
AgtName Tier1
a b
b c
c d
d NA
e b
My orginal plan was to use JSTL to retreive the data in a loop function. It will search the second coloumn and retreive data in a zigzag style. It would also stop when the data is NA
An example is when the search paramater is 'a', it would retreive the data like this ' b c d NA'
If it is 'e', it would be 'b c d NA'
These are my codes
<c:choose>
<c:when test="${param.search!=null}">
<sql:query var="result2" dataSource="${dataSource}">
select * from testinzigzag
where Name like ?
<sql:param value="${param.search}" />
</sql:query>
<c:forEach var="row2" items="${result2.rows}">
<c:choose>
<c:when test="${row2.UpperTier!='NA'}">
${row2.UpperTier}
<c:set var="loopVar" value="${row2.UpperTier}" />
<!-- Start:You will have to start the coding part here -->
<c:choose>
<c:when test="${row2.UpperTier!='NA'}">
<sql:query var="result3" dataSource="${dataSource}">
select * from testinzigzag
where Name like ?
<sql:param value="${row2.UpperTier}" />
</sql:query>
<c:forEach var="row3" items="${result3.rows}">
${row3.UpperTier}
<c:choose>
<c:when test="${row3.UpperTier!='NA'}">
<sql:query var="result4" dataSource="${dataSource}">
select * from testinzigzag
where Name like ?
<sql:param value="${row3.UpperTier}" />
</sql:query>
<c:forEach var="row4" items="${result4.rows}">
${row4.UpperTier}
<c:choose>
<c:when test="${row4.UpperTier!='NA'}">
<sql:query var="result5" dataSource="${dataSource}">
select * from testinzigzag
where Name like ?
<sql:param value="${row4.UpperTier}" />
</sql:query>
<c:forEach var="row5" items="${result5.rows}">
${row5.UpperTier}
</c:forEach>
</c:when>
</c:choose>
</c:forEach>
</c:when>
</c:choose>
</c:forEach>
</c:when>
</c:choose>
<!-- End: You will have to end the coding part here -->
</c:when>
<c:when test="${row2.UpperTier=='NA'}">
No Upper Tier
</c:when>
</c:choose>
</c:forEach>
</c:when>
</c:choose>
Sorry for the doublepost, continuing from the last post
I can only code it in a way that it is not done in a loop. Assuming i have 50 tiers, I would not to do it 50 times. Is there a way that I can do it in a loop?
Similar Messages
-
Help in sorting the data using Rank
Hello Experts
I am having trouble in selecting the record which is one less than the maximum rank Please see the desired results part.
I am trying using the Rank or Dense_rank but I could not.
Please help in solving this issue.
The Oracle version I am working on is
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Thanks
RB
with t as
SELECT 29951 SOURCE_ID,'03/4/2013' CREATE_DATE, 'AAAA' NAME FROM DUAL UNION ALL
SELECT 29951 SOURCE_ID,'03/11/2013' CREATE_DATE, 'BBBB' NAME FROM DUAL UNION ALL
SELECT 29951 SOURCE_ID,'03/21/2013' CREATE_DATE, 'CCCC' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/14/2013' CREATE_DATE, 'SSSS' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/4/2013' CREATE_DATE, 'TTTT' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/24/2013' CREATE_DATE, 'PPPP' NAME FROM DUAL UNION ALL
SELECT 29953 SOURCE_ID,'03/01/2013' CREATE_DATE, 'MMMM' NAME FROM DUAL UNION ALL
SELECT 29953 SOURCE_ID,'03/11/2013' CREATE_DATE, 'RRRR' NAME FROM DUAL UNION ALL
SELECT 29954 SOURCE_ID,'03/24/2013' CREATE_DATE, 'WWWW' NAME FROM DUAL
SELECT row_number() over (PARTITION BY source_id ORDER BY SOURCE_ID,create_date ) rank, source_id,create_date
FROM t
SOURCE_ID CREATE_DATE NAME
29951 03/11/2013 BBBB
29952 03/14/2013 SSSS
29953 03/1/2013 MMMM
29954 03/24/2013 WWWWselect source_id,create_date,name
from (
SELECT row_number() over (PARTITION BY source_id ORDER BY create_date ) rank, source_id,create_date,name
FROM t
where rank = 1
Perhaps you want to handle the dates as dates.
Do you want the first or the second rank?
Could there be equal create_dates in one partition?
What do you expect as second for source_id=29954?
select source_id,create_date,name
from (
SELECT row_number() over (PARTITION BY source_id ORDER BY to_date(create_date,'MM/DD/YYYY') ) rank, source_id,create_date,name
FROM t
where rank = 2
SOURCE_ID
CREATE_DATE
NAME
29951
03/11/2013
BBBB
29952
03/14/2013
SSSS
29953
03/11/2013
RRRR
Ah, now i see, you want descending order
select source_id,create_date,name
from (
SELECT row_number() over (PARTITION BY source_id ORDER BY to_date(create_date,'MM/DD/YYYY') desc ) rank, source_id,create_date,name
FROM t
where rank = 2
Finally i might have understood
with t as
SELECT 29951 SOURCE_ID,'03/4/2013' CREATE_DATE, 'AAAA' NAME FROM DUAL UNION ALL
SELECT 29951 SOURCE_ID,'03/11/2013' CREATE_DATE, 'BBBB' NAME FROM DUAL UNION ALL
SELECT 29951 SOURCE_ID,'03/21/2013' CREATE_DATE, 'CCCC' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/14/2013' CREATE_DATE, 'SSSS' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/4/2013' CREATE_DATE, 'TTTT' NAME FROM DUAL UNION ALL
SELECT 29952 SOURCE_ID,'03/24/2013' CREATE_DATE, 'PPPP' NAME FROM DUAL UNION ALL
SELECT 29953 SOURCE_ID,'03/01/2013' CREATE_DATE, 'MMMM' NAME FROM DUAL UNION ALL
SELECT 29953 SOURCE_ID,'03/11/2013' CREATE_DATE, 'RRRR' NAME FROM DUAL UNION ALL
SELECT 29954 SOURCE_ID,'03/24/2013' CREATE_DATE, 'WWWW' NAME FROM DUAL
, ranks as (
SELECT
row_number() over (PARTITION BY source_id ORDER BY to_date(create_date,'MM/DD/YYYY') desc ) rank
,source_id
,create_date
,name
FROM t
select
source_id
,create_date
,name
from ranks r
where rank =
case
when (select count(*) from ranks where source_id = r.source_id) = 1
then 1 else 2
end
SOURCE_ID
CREATE_DATE
NAME
29951
03/11/2013
BBBB
29952
03/14/2013
SSSS
29953
03/01/2013
MMMM
29954
03/24/2013
WWWW
Message was edited by: chris227 extended -
Help needed in inserting data using a query
I need to have some data as a result of the following query:
select sched_num,load_id,ord_id,split_id from ord_load_seq
where (ord_id,split_id,sched_num) in (select ord_id,split_id,sched_num from ord_load_seq where seq_num = '2'
group by ord_id,split_id,sched_num having count(1) >1)
order by ord_id,split_id,sched_num;
But currently it retunrns no rows. The problem is in the having count(1)> 1 clause.
When i make =1, it returns rows. But no rows on > 1. I even tried inserting some rows to get the result >1
But still the query on a whole returns no rows.Please help.ohhh... lets start our lesson children:
here is code to consider:
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
SQL>
SQL> --Q1
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3 from tbl
12 order by fld1, fld2, fld3
13 /
FLD1 FLD2 FLD3
1 1 1
1 1 2
1 1 3
1 2 3
1 3 3
SQL> --Q2
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3, count(1) from tbl
12 group by fld1,fld2,fld3
13 order by fld1, fld2, fld3
14 /
FLD1 FLD2 FLD3 COUNT(1)
1 1 1 1
1 1 2 1
1 1 3 1
1 2 3 1
1 3 3 1
SQL> --Q3
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3 from tbl
12 group by fld1,fld2,fld3
13 having count(1) > 1
14 order by fld1, fld2, fld3
15 /
FLD1 FLD2 FLD3
SQL> --Q4
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3 from tbl
14 order by fld1, fld2, fld3
15 /
FLD1 FLD2 FLD3
1 1 1
1 1 2
1 1 2
1 1 3
1 2 3
1 3 3
6 rows selected
SQL> --Q5
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3, count(1) from tbl
14 group by fld1,fld2,fld3
15 order by fld1, fld2, fld3
16 /
FLD1 FLD2 FLD3 COUNT(1)
1 1 1 1
1 1 2 2
1 1 3 1
1 2 3 1
1 3 3 1
SQL> --Q6
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3 from tbl
14 group by fld1,fld2,fld3
15 having count(1) > 1
16 order by fld1, fld2, fld3
17 /
FLD1 FLD2 FLD3
1 1 2
SQL> Q1. As you may see we have an bunch of data where each row is unique combination of the columns value.
Q2. lets try to group it by fld1 and fld2 and fld3 columns. We don't expect any miracle and got the same data as Q1. Why? Because each row is unique combination(group) in scope of fld1, fld2, fld3 - count(1) exactly shows us that.
Q3. Q2 is explanation why we got no rows filter (having count(1) > 1)because the result of the clause is always false.
Q4. Lets put some duplication.
Q5. Now we got some new result. Count shows us group with more then one rows.
Q6. Shows us exact group which we've found in Q5. -
Help needed to load data using sql loader.
Hi,
I trying to load data from xls to oracle table(solaris OS) and its failing to load data.
Control file:
LOAD DATA
CHARACTERSET UTF16
BYTEORDER BIG ENDIAN
INFILE cost.csv
BADFILE consolidate.bad
DISCARDFILE Sybase_inventory.dis
INSERT
INTO TABLE FIT_UNIX_NT_SERVER_COSTS
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
HOST_NM,
SERVICE_9071_DOLLAR DOUBLE,
SERVICE_9310_DOLLAR DOUBLE,
SERVICE_9700_DOLLAR DOUBLE,
SERVICE_9701_DOLLAR DOUBLE,
SERVICE_9710_DOLLAR DOUBLE,
SERVICE_9711_DOLLAR DOUBLE,
SERVICE_9712_DOLLAR DOUBLE,
SERVICE_9713_DOLLAR DOUBLE,
SERVICE_9720_DOLLAR DOUBLE,
SERVICE_9721_DOLLAR DOUBLE,
SERVICE_9730_DOLLAR DOUBLE,
SERVICE_9731_DOLLAR DOUBLE,
SERVICE_9750_DOLLAR DOUBLE,
SERVICE_9751_DOLLAR DOUBLE,
GRAND_TOTAL DOUBLE
Log file:
Table FIT_UNIX_NT_SERVER_COSTS, loaded from every logical record.
Insert option in effect for this table: INSERT
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
HOST_NM FIRST * , CHARACTER
SERVICE_9071_DOLLAR NEXT 8 DOUBLE
SERVICE_9310_DOLLAR NEXT 8 DOUBLE
SERVICE_9700_DOLLAR NEXT 8 DOUBLE
SERVICE_9701_DOLLAR NEXT 8 DOUBLE
SERVICE_9710_DOLLAR NEXT 8 DOUBLE
SERVICE_9711_DOLLAR NEXT 8 DOUBLE
SERVICE_9712_DOLLAR NEXT 8 DOUBLE
SERVICE_9713_DOLLAR NEXT 8 DOUBLE
SERVICE_9720_DOLLAR NEXT 8 DOUBLE
SERVICE_9721_DOLLAR NEXT 8 DOUBLE
SERVICE_9730_DOLLAR NEXT 8 DOUBLE
SERVICE_9731_DOLLAR NEXT 8 DOUBLE
SERVICE_9750_DOLLAR NEXT 8 DOUBLE
SERVICE_9751_DOLLAR NEXT 8 DOUBLE
GRAND_TOTAL NEXT 8 DOUBLE
Record 1: Rejected - Error on table FIT_UNIX_NT_SERVER_COSTS, column HOST_NM.
Field in data file exceeds maximum length
Table FIT_UNIX_NT_SERVER_COSTS:
0 Rows successfully loaded.
1 Row not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Please help me ASAP.
Awaiting u r reply.Hi,
I verified and everything looks fine according to me.
Table structure:
OST_NM VARCHAR2(30)
SERVICE_9071_DOLLAR NUMBER(8,2)
SERVICE_9310_DOLLAR NUMBER(8,2)
SERVICE_9700_DOLLAR NUMBER(8,2)
SERVICE_9701_DOLLAR NUMBER(8,2)
SERVICE_9710_DOLLAR NUMBER(8,2)
SERVICE_9711_DOLLAR NUMBER(8,2)
SERVICE_9712_DOLLAR NUMBER(8,2)
SERVICE_9713_DOLLAR NUMBER(8,2)
SERVICE_9720_DOLLAR NUMBER(8,2)
SERVICE_9721_DOLLAR NUMBER(8,2)
SERVICE_9730_DOLLAR NUMBER(8,2)
SERVICE_9731_DOLLAR NUMBER(8,2)
SERVICE_9750_DOLLAR NUMBER(8,2)
SERVICE_9751_DOLLAR NUMBER(8,2)
GRAND_TOTAL NUMBER(8,2)
Control file:
LOAD DATA
BYTEORDER BIG ENDIAN
INFILE cost.csv
BADFILE consolidate.bad
DISCARDFILE Sybase_inventory.dis
INSERT
INTO TABLE FIT_UNIX_NT_SERVER_COSTS
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
HOST_NM ,
SERVICE_9071_DOLLAR NUMBER(8,2),
SERVICE_9310_DOLLAR NUMBER(8,2),
SERVICE_9700_DOLLAR NUMBER(8,2),
SERVICE_9701_DOLLAR NUMBER(8,2),
SERVICE_9710_DOLLAR NUMBER(8,2),
SERVICE_9711_DOLLAR NUMBER(8,2),
SERVICE_9712_DOLLAR NUMBER(8,2),
SERVICE_9713_DOLLAR NUMBER(8,2),
SERVICE_9720_DOLLAR NUMBER(8,2),
SERVICE_9721_DOLLAR NUMBER(8,2),
SERVICE_9730_DOLLAR NUMBER(8,2),
SERVICE_9731_DOLLAR NUMBER(8,2),
SERVICE_9750_DOLLAR NUMBER(8,2),
SERVICE_9751_DOLLAR NUMBER(8,2),
GRAND_TOTAL NUMBER(8,2)
Sample date file:
ABOS12,122.46,,1315.00,,1400.00,,,,,,,,1855.62,,4693.07
ABOS39,6391.16,,1315.00,,1400.00,,,,,,,,,4081.88,13188.04 -
How to loop through dates using For Loop?
Hi All,
I assume the For Loop is the best way to loop through days in a date range, but I can't figure out how to add a day in the "AssignExpression" box. The following gets the errors "The expression contains unrecognized token 'DAY'",
and "Attempt to parse the expression 'DATEADD(DAY, 1, @CounterPlayer)' failed and returned error code 0xC00470A4."
InitExpression: @CounterPlayer = @DownloadFileDatePlayer
EvalExpression: @CounterPlayer <= @Today
AssignExpression: @CounterPlayer = DATEADD(DAY, 1, @CounterPlayer)
I need to step through days, not through files. What am I doing wrong here? I changed "DAY" to "Day," but that didn't fix it.
Thanks,
EricDOH! It just needed properly placed quotes. Here's the answer:
AssignExpression: @CounterPlayer = DATEADD("DAY", 1, @CounterPlayer) -
Need help with returning NULL data using DECODE
Hello again! I am new to PL/SQL and still fairly new to SQL. I have a query that returns several columns of data and based on the year entered I want either current data or past data. If the number is null that is considered current data only.
Below is part of my where clause, it kinda of works the way I want. It is returning the correct numbers but it is not returning any null numbers when I enter 2007 for the current year. I hope this makes sense, any suggestions/tips would be great thanks!
WHERE table1.num = decode(table1.num,
null,
decode(:p_year, to_char (current_date,'yyyy'),
table1.num,null),
decode(:p_year,(select to_char(open_date,'yyyy') from table2 where table2.num = table1.num),
table1.num,null))maybe something like this?
WHERE Nvl(table1.num,'x') = Decode(table1.num, null, Decode(:p_year, to_char(current_date,'yyyy'), table1.num, 'x'),
Decode(:p_year, (select to_char(open_date,'yyyy') from table2 where table2.num = table1.num), table1.num, 'x')) note: untested -
Need help about RRD4J, get data from rrdb
i need more help about roundrobin database, especially using RRD4J library.
i want to know, if i have one file database data1.rrd and i specific want to get data from startTime to endTime.
how i can get that data from that database, and move them to another database file data2.rrd.
can i do this?thx jschell
javadoc from rrd4j not clearly enough for me to understanding about prosesing add, update and get data in there, so i ask in this forum may be anyone can give me solution.
i think it's simple problem but i don't know how to implement with this API.
with rrd4j we can create roundrobin database (rrd), the output in example: data1.rrd
i just want to get data that i had put in data1.rrd to move them to another rrd, example: data2.rrd.
data1.rrd and data2.rrd, they have same lastupdate time. -
Exporting whole database (10GB) using Data Pump export utility
Hi,
I have a requirement that we have to export the whole database (10GB) using Data Pump export utility because it is not possible to send the 10GB dump in a CD/DVD to the system vendor of our application (to analyze few issues we have).
Now when i checked online full export is available but not able to understand how it works, as we never used this data pump utility, we use normal export method. Also, will data pump reduce the size of the dump file so it can fit in a DVD or can we use Parallel Full DB export utility to split the files and include them in a DVD, is it possible.
Please correct me if i am wrong and kindly help.
Thanks for your help in advance.You need to create a directory object.
sqlplus user/password
create directory foo as '/path_here';
grant all on directory foo to public;
exit;
then run you expdp command.
Data Pump can compress the dumpfile if you are on 11.1 and have the appropriate options. The reason for saying filesize is to limit the size of the dumpfile. If you have 10G and are not compressing and the total dumpfiles are 10G, then by specifying 600MB, you will just have 10G/600MB = 17 dumpfiles that are 600MB. You will have to send them 17 cds. (probably a few more if dumpfiles don't get filled up 100% due to parallel.
Data Pump dumpfiles are written by the server, not the client, so the dumpfiles don't get created in the directory where the job is run.
Dean -
How to Select data using same column name from 3 remote database
Hi,
Can anyone help me on how to get data with same column names from 3 remote database and a single alias.
Ex.
SELECT *
a.name, b.status, SUM(b.qty) qantity, MAX(b.date) date_as_of
FROM
*((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)a,*
*(table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)b)*
WHERE b.dept = 'finance'
AND a.position = 'admin'
AND a.latest = 'Y' AND (b.status <> 'TRM') AND b.qty > 0;
GROUP BY a.name, b.status ;
NOTE: the bold statements is just an example of what I want to do but I always gets an error beacause of ambiguous columns.
Thanks in advnce. :)
Edited by: user12994685 on Jan 4, 2011 9:42 PMuser12994685 wrote:
Can anyone help me on how to get data with same column names from 3 remote database and a single alias.Invalid. This does not make sense and breaks all scope resolution rules. And whether this is in a single database, or uses tables across databases, is irrelevant.
Each object must be uniquely identified. So you cannot do this:
select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a3 objects cannot share the same alias. Example:
SQL> select * from (dual, dual) d;
select * from (dual, dual) d
ERROR at line 1:
ORA-00907: missing right parenthesisYou need to combine the objects - using a join or union or similar. So it will need to be done as follows:
SQL> select * from (select * from dual d1, dual d2) d;
select * from (select * from dual d1, dual d2) d
ERROR at line 1:
ORA-00918: column ambiguously definedHowever, we need to have unique column names in a SQL projection - so the join of the tables need to project a unique set of columns. Thus:
SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
DUM DUM
X X
SQL> I suggest that you look closely at what scope is and how it applies in the SQL language - and ignore whether the objects referenced are local or remote as it has no impact to fundamentals of scope resolution. -
Retreiving a date from database and converting it into a string in a format
hi all,
iam having a date field which stores values ,for eg:2002-04-26 00:00:00.i want to retreive the date and i want to convert in a String in dd/mm/yyyy format.how can i do so.plz explain me..........thanks in advanceIf the field is a Date in your database, you can use the ResultSet.getDate() method, which will return a java.sql.Date (which extends java.util.Date).
You can then use SimpleDateFormat to format it the way you like.
See the API doc for more details. -
Populate ComboBox from database - NOT using Flex Data Services
Hi there,
We are using CF with Flex but are not using the Flex Data
Service. I'm very much a newb and I'm having trouble finding any
information on how to populate controles from a database without
using Flex Data Service. Any help would be greatly appreciated.
First I have a page... JobSearch.mxml that contains a combo
box that I want to populate with the job_id and job_title from a
MSSQL database.
In Flex in the RDS DataView I used the "Create CFC" Wizard
which generated "job.cfc" and "jobGateway.cfc". It also generated
"job.as".
The CF Function that selects the data appears to be defaulted
and called "load" and the .as function is called simply "job".
So, that all looks great. But I can't find any information on
what I need to have on my JobSearch.mxml to actually get this data
into the comboBox.
I did:
<mx:Script>
<![CDATA[
[Bindable]
public var jobData:job = null;
]]>
</mx:Script>
And then:
<mx:ComboBox
text="{jobData.job_title}"></mx:ComboBox>
But I'm being told "Type was not found or was not a
complie-time constant: job"
I guess I'm missing something, or doing something way
wrong... I just don't know enough of Flex at this point to know
what it is.
Thanks!
AprilUsing php or asp is not an option, as we are a Cold Fusion
House.
I was looking at an article on Ben Forta's blog (
http://www.forta.com/blog/index.cfm?mode=e&entry=1786)
and following his example I did this... only it doesn't work:
I'm very very new to Flash and we are using ColdFusion but
are not using Flex Data Services. I've been trying to figure out
how to populate a combobox from a database and I'm just not having
any luck.
My project is called "PreTraffic". I have my main file as
"JobSearch.mxml" and a folder under the root named "cfc" with a
file called "job.cfc".
job.cfc contains the following code:
<cfcomponent>
<!--- Get jobs --->
<cffunction name="GetJob" access="remote"
returntype="query" output="false">
<cfset var job="">
<cfset var results="">
<cfquery datasource="discsdev" name="job">
SELECT job_id, job_title
FROM job
WHERE status = 'O'
ORDER BY job_title
</cfquery>
<cfquery dbtype="query" name="results">
SELECT job_title AS label, job_id AS data
FROM job
ORDER BY label
</cfquery>
<cfreturn results>
</cffunction>
</cfcomponent>
And JobSearch.mxml has the following code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*"
layout="absolute"
backgroundGradientColors="[#ffffff, #d0d0d0]"
creationComplete="InitApp()">
<mx:Style source="style.css" />
<mx:Script>
<![CDATA[
public function InitApp():void {
jobSvc.GetJob();
]]>
</mx:Script>
<!-- ColdFusion CFC (via AMF) -->
<mx:RemoteObject id="jobSvc" destination="PreTraffic"
showBusyCursor="true" />
<mx:VBox label="Job History" width="100%" height="100%"
x="10" y="92">
<mx:Label text="Search jobs by"/>
<mx:Form label="Task" width="100%">
<mx:FormItem label="Job Name:">
<mx:ComboBox id="jobNameCB"
dataProvider="{jobSvc.GetJob.results}"></mx:ComboBox>
</mx:FormItem>
</mx:Form>
<mx:HBox>
<mx:Button label="Search"/>
<mx:Button label="Clear"/>
</mx:HBox>
</mx:VBox>
</mx:Application>
My Compiler thingy points to:
-services
"/Volumes/flexwwwroot/WEB-INF/flex/job-services-config.xml" -locale
en_US
and job-services-config.xml contains the following code:
<destination id="PreTraffic">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>flex.pretraffic.cfc.job</source>
<lowercase-keys>true</lowercase-keys>
</properties>
</destination>
Well, when I run the app... the combobox is not populated...
Can anyone help with what I've done wrong?
Thanks!
April -
Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?
Now a days we are saving / extracting data in a excel spreadsheet, but we would like to do that using a database because it is better.You can use ODBC connection to work with SQL Server database.
Use SQLExec object to execute the SQL statement. Here is a KB about the SQL statement.
http://digital.ni.com/public.nsf/allkb/4ADEEA04CD24AE0B862565E20002A16F?OpenDocument
To write data to spreadsheet is more straightforward because Lookout has built-in spreadsheet object. But you need to write SQL statement by yourself to interact with other database.
To read the data back is the same way. Just use "select" SQL statement to query. You can use Datatable object to query.
The "Data Source" can be "DSN = data source name;". The data source name is configured in Control Panel->Administrative Tools->Data Sources(ODBC).
Ryan Shi
National Instruments -
Saving data in database by using MM17
I have customised fields in MARA table. I want to save the data in database by using Mass transaction MM17. Can any one can give the solution.
Please do not post the same question more than once. Please read the Terms of Engagement. I have deleted your duplicate posts.
-
Differences between using Data Pump to back up database and using RMAN ?
what are differences between using Data Pump to back up database and using RMAN ? what is CONS and PROS ?
ThanksSearch for Database backup in
http://docs.oracle.com/cd/B28359_01/server.111/b28318/backrec.htm#i1007289
In short
RMAN -> Physical backup.(copies of physical database files)
Datapump -> Logical backup.(logical data such as tables,procedures)
Docs for RMAN--
http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmcncpt.htm#
Docs for Datapump
http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_overview.htm
Edited by: Sunny kichloo on Jul 5, 2012 6:55 AM -
Using a second table in a Database Data Block ??
In a Form, I have a Data Block which is a Database Data Block. The Items are associated with columns in a table.
I want the items in this repeating block to show in a different order. To do this, I need to use a second table and say where table1.key = table2.key ....
I keep getting problems at runtime with
ORA-00918: column ambiguously defined
I tried to qualify everywhere a column name is used. When I do show error it shows
SELECT ROWID, ....
And then the "column ambiguously defined".
I do not have an item in my Form for ROWID. Maybe it is automatic. (This form DOES do update).
Is it possible to use two tables in a Data Block like this?
ThanksIf you only need to order the records in the block, why not defining the "ORDER BY" clause in the block's property??
Set the "ORDER BY" clause at design time from the property palette of the block or runtime with column of your choice.
at runtime your can use:
SET_BLOCK_PROPERTY('your_block', ORDER_BY, 'your_column');If you need to join to tables in one block read the [Block Based on Join|http://www.oracle.com/technology/products/forms/pdf/BlockOnAJoin.pdf] Documentation.
Tony
Maybe you are looking for
-
Dear frnds, I have created a sales order (billing plan) from which i directly create the down payment request. I am able to save the same but when i try to go bacak to the document it gives me the follwoing error "Maintain de
-
How do i remove my agenda data from my ipod touch
how do I remove my agenda completely form my ipod touch
-
Since the Migration to ACS 5.5.0.46 we keep seeing the following message in the alarm inbox Cisco Secure ACS Alarm (CRITICAL): Physical size of ACS db is more than 50% of its Actual Size. Cisco Secure ACS - Alarm Notification Severity: Critical Alarm
-
Lost compatibility with external hard drives
I've updated to the most recent version of Mavericks and now my external Seagate back up hard drive isn't usable. It's recognised at connected in the disk utility but I'm not able to use it? Any ideas on compatibility issues?
-
How do I permanently uninstall Safari in Lion?
I just bought this Imac as my 3rd apple computer. The Safari in my MacAir and MacPro is fine but this ******* safari in Imac is *&^(*&^%*&^$%*^&%*&&^n me off and wasted all my research and setup times ; when one page refreshes, all 15 tabs refresh wi