Return each value only once using cfloop query
Hello
I have a code that fills a cfselect list dynamically and then fills a second list based on these values. Everything seems to work fine, except that all values are taken from the database, and there are duplicates in the majority of cases. For example, the 1S1W is displayed in the dropdown value 10 times, where I'll settle it there once.
Is it possible to have one of each value in my list?
< isDefined ('form.select_Main_Group') cfif >
< cfset page.select_Main_Group = form.select_Main_Group >
< / cfif >
< cfoutput >
< name of the form = "DropDown" method = "post" >
<!--> query DB for the first descent to the bottom of the list
< CFQUERY name = "get_Main_Group" datasource = "ds" dbtype = "odbc" >
SELECT *.
FROM slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
ON slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
ORDER BY page_description
< / CFQUERY >
<!--> first drop-down list
<! - VIEW the onChange event of javascript in the select tag, it's what sends the form after the first selection - >
< select name = "select_Main_Group" required = "yes" onchange = "this.form.submit ()" >
< option > select Township/range < / option >
<!-dynamically populate the first drop drop down based on the get_Main_Group query->
<!-NOTICE the CFIF in the option tag, that said, if the first selection has occurred, display the chosen option when pages are reloaded->
< cfloop query = "get_Main_Group" >
< option value = "" #SECTION # "< cfif isDefined ('form.select_Main_Group') > < selected cfif form.select_Main_Group eq ' #SECTION # ' > < / cfif > < / cfif > > #TOWNSHIP_RANGE # < / option >"
< / cfloop >
< / select >
< p >
<! - if the first selection has been made, see the second dropdown menu with the appropriate results - >
< isDefined ('page.select_Main_Group') cfif >
<! - query DB for second drop to the bottom of the list, based on the selected item in the list - >
< cfquery name = "get_Sub_Group" datasource = "ds" dbtype = "odbc" >
SELECT TOWNSHIP_RANGE, SECTION
FROM slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
ON slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
WHERE the ARTICLE = ' #page.select_Main_Group # '.
< / cfquery >
<!--> the second drop down menu
< select name = "select_Sub_Group" required = "yes" >
Section select < option > < / option >
<! - dynamically fill the second fall to the bottom of the list based on the get_Sub_Group query - >
< cfloop query = "get_Sub_Group" >
< option value = "#SECTION #" > #SECTION # < / option >
< / cfloop >
< / select >
< / cfif >
< / make >
< / cfoutput >
Emily,
Easy fix. Use the same approach you did to determine when the second menu drop-down. Change this line:
to these:
Tags: ColdFusion
Similar Questions
-
Return a value of date using a function
I have a function in which I'm passing a date, but given the entry as a varchar data type.
I'm the date inside the print function value and then return the value date.
When I'm passing through January 20, 2009 as the date, I make out like 20 January 09 only.
The year is get truncated in the output.
How can I get January 20, 2009 as the value of output.
Thanks in advance
Kind regards
RambeauTry this:
DECLARE MANIFEST_DT VARCHAR2(25) := '20-Jan-2009'; V_SAMP_DT DATE; BEGIN SELECT TO_DATE(MANIFEST_DT,'DD-MON-YYYY') + 4 INTO V_SAMP_DT from dual; DBMS_OUTPUT.PUT_LINE('SAMPLE DATE IS: ' ||to_char(V_SAMP_DT, 'dd-Mon-yyyy')); END; /
When you store/work with dates in the database, it is best to convert the dates as a string in the format of date (with to_date) as soon as possible.
When you need a date in the format of a specific way when it came to the end/screen/report on the forehead, then use to_char to return a date into a string format.
Published by: Boneist on January 20, 2009 11:41
-
Return multiple values at once of the listOfValues region
Friends,
I created a (listOfValues) region that has 4 fields/columns
ResponsibilityName, ResponsibilityId, ApplicationName, ApplicationId
I assigned a responsibility field ResponsibilityName of the listOfValues in a page.
It works fine when I select a value in this LOV. It returns a value to the field of 'Responsibility' of the page.
Is it possible to return the other 3 fields so while selecting ResponsibilityName in LOV. for example while you select a value for the field 'Responsibility', can the LOV return ResponsibilityId LOV to the 'ResponsibilityId' field in the page, at the same time?
1 selection can return values 1 to the fields?You can return multiple values in the LOV. Simply create a result to the mapping of the array element Lov to the basic element of page. Once you select a value from the LOV, the element of basic page could get filled in with the value on the table of lov whereby it has been mapped.
Concerning
Sumit -
Set the indicator value only once
Hello
I'm relatively new to LabVIEW, so I was wondering if you could give me some advice as how to accomplish a task.
I am trying to store the timestamp at which a signal caused a block "Trigger and gate" trigger. I joined my current attempt to do this. The idea is essentially to wait the trigger signal to go out and put the component 't0' of it within an indicator. The problem is that after I store the t0, the while the iteration is complete. For the next iteration, new data comes from. Because the trigger is already triggered the previous iteration (it has no trigger stop), this new data t0 will then write to the indicator. But this isn't what I want. Is it possible to write data only to an indicator if it does not contain a value already?
My plan is to take the blocks from the trigger and active in the end (see the picture I have attached) and create a Subvi from it. The data source will be outside the Subvi, so I can connect different sources during the tests. It means (as far as I know), that the Subvi is unclear it is integrated inside a loop, so I won't be able to use the features of a loop (ie: shift registers) to solve my problem.
Do you have any suggestions as to what I should try?
Thank you!
PS: Has the computer on which the final code will run on LabVIEW 8.6
kkrizka wrote:
Is it possible to write data only to an indicator if it does not contain a value already?
"" Place the indicator insde the true case of a structure of the case and the wire the "first call?" primitive to the terminal selector.
-
How to display the values of sno using the query?
Hi all
I use oracle 10g. Could u pls help for sno or count as follows.below is the set of sample data,
I need the o/p should be displayed with the County as follows.100 JOE 1-JAN-2012 1000 100 JOE 15-FEB-2012 3000 200 MAX 1-MAR-2012 5000 200 MAX 1-APR-2012 5000 200 MAX 1-MAY-2012 4000 .... ..... ............... ......
How to reach this sno 1,2,3 for each record? is it possible?. can u suggest me the solution?sno eno name hdate amt 1 100 JOE 1-JAN-2012 1000 2 100 JOE 15-FEB-2012 3000 1 200 MAX 1-MAR-2012 5000 2 200 MAX 1-APR-2012 5000 3 200 MAX 1-MAY-2012 4000 .. .... ..... ............... ......
Thank you
Concerning
VidsHi vidusnat,
SQL> with t as ( 2 select 100 eno, 'JOE' name, to_date('1-JAN-2012', 'DD-MON-YYYY') hdate, 1000 amt from dual 3 union all 4 select 100 eno, 'JOE' name, to_date('15-FEB-2012', 'DD-MON-YYYY') hdate, 3000 amt from dual 5 union all 6 select 200 eno, 'MAX' name, to_date('1-MAR-2012', 'DD-MON-YYYY') hdate, 5000 amt from dual 7 union all 8 select 200 eno, 'MAX' name, to_date('15-APR-2012', 'DD-MON-YYYY') hdate, 5000 amt from dual 9 union all 10 select 200 eno, 'MAX' name, to_date('15-MAY-2012', 'DD-MON-YYYY') hdate, 4000 amt from dual 11 ) 12 select row_number() over (partition by t.eno order by t.hdate),t.* from t 13 ; SQL> / ROW_NUMBER()OVER(PARTITIONBYT.ENOORDERBYT.HDATE) ENO NAM HDATE AMT ------------------------------------------------ ---------- --- --------- ---------- 1 100 JOE 01-JAN-12 1000 2 100 JOE 15-FEB-12 3000 1 200 MAX 01-MAR-12 5000 2 200 MAX 15-APR-12 5000 3 200 MAX 15-MAY-12 4000 SQL>
Kind regards
Gennady -
Some subjects appear twice in the list of topics, but each exists only once in the project files. What are the causes for this and what can do to prevent it? I am using HR 11.0.4.291. I deleted the CPD file.
Here is an example:
Change in all files in a folder specific to say the first element. There may be two files in the same folder that Windows does not allow that. My guess is that the duplicates are in different folders and change the folder will help you find the original and the duplicate.
Also open both the list of topics. Should be the red squares in it? If Yes, you have sort of a release in the source.
Post back with what you find.
See www.grainge.org for creating tips and RoboHelp
-
How to run VB of JSX and return a value?
Someone knows how to do this?
$.writeln('result:\r' + app.doScript('wsh.echo "test"', ScriptLanguage.VISUAL_BASIC));
WSH and wscript give an error 'object required '. Same script works very well as a vbs file.
It seems that these objects are simply not available when executing doScript, but y at - it another way to return a value?
Justin Putney says:
Substances. wrote:
FWIW, to return a value from VB using doScript, you need returnValue = SomeValue at the end of your VB script.
I know that this is the case with a Sub or Function... is that his operation at the end of a script as well?
To answer your questions, here is an excerpt of work I have that gets the file in Excel:
var vbs = 'Set MyXL = GetObject(, "Excel.Application")\r' + 'Set ActiveXL = MyXL.activeworkbook\r'+ 'returnValue = ActiveXL.Path'; var path = app.doScript(vbs,ScriptLanguage.VISUAL_BASIC);
-
Query must return the values null
Hi once again, everything
The query below should return zero values for the date, but instead it brings back each transaction in the table, any ideas why?
SELECT CID.transaction_id, MMT.ITEM_ORD PART_NUMBER, CID.DESCRIPTION, CID.TRANSACTION_TYPE_NAME, CID.LINE_TYPE_NAME, CID.SUBINVENTORY_CODE, MMT.TRANSACTION_QUANTITY, CID.BASE_TRANSACTION_VALUE TRANSACTION_VALUE, GLC.SEGMENT1, GLC.SEGMENT2, GLC.SEGMENT3, GLC.SEGMENT4, GLC.SEGMENT6, TO_CHAR (MMT.TRANSACTION_DATE, 'DD-MON-YY HH24:MI') transaction_date_and_time, TRUNC (MMT.TRANSACTION_DATE) transaction_date FROM CST_INV_DISTRIBUTION_DAV_V CID, MTL_MATERIAL_TXNS_VAL_V MMT, GL_CODE_COMBINATIONS GLC WHERE CID.TRANSACTION_ID = MMT.TRANSACTION_ID AND CID.REFERENCE_ACCOUNT = GLC .CODE_COMBINATION_ID; AND MMT.TRANSACTION_DATE = '26-AUG-11 22:00'
Yes. It's true. You must use TO_DATE to convert a string to a date and you must use TO_CHAR to convert a date into a string.
-
reload the page when SQL query returns a value
Hello world
the title of this discussion may seem strange, but I'll try to explain why I need this:
A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.
Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.
Thank you!
Here is an overview of how it can be done
This is possible thanks to a dynamic action being performed on a timer.
View default tabs and dynamic action hide them on loading the page if they are not to be considered
Create a dynamic action that will execute your query every 5 seconds or more
If the query returns data, you can use the dynamic action to show your tabs using javascript
-
How to return the value 0 for no data using the County?
Hi all
I used this query to count the number of records for each month of the year:
SELECT DISTINCT COUNT (I.information_sid) COUNT, TO_DATE (TO_CHAR (INSERT_DATE, 'MM'), 'MM') MONTH
INFORMATION I
TO_DATE GROUP (TO_CHAR (INSERT_DATE, 'MM'), 'MM')
ORDER BY TO_DATE (TO_CHAR (INSERT_DATE, 'MM'), 'MM')
But this code returns no value for months without data
I want to return the value '0' for any month of data. How, please?
Note: I use reports 6i.Maybe this?
SELECT SUM(CNT_REC) CNT_REC, MONTH FROM ( SELECT COUNT(I.information_sid) CNT_REC, TO_DATE(TO_CHAR(INSERT_DATE,'MM'),'MM') MONTH FROM INFORMATIONS I GROUP BY TO_DATE(TO_CHAR(INSERT_DATE,'MM'),'MM') UNION ALL SELECT 0, LPAD(ROWNUM,2,0) FROM ALL_OBJECTS WHERE ROWNUM <= 12 ) GROUP BY MONTH ORDER BY MONTH
No need to SEPARATE during the use of GROUP BY.
-Clément
-
After the update to el Capitan my iMac will not be asleep. I put it to sleep and turn off the mouse and keyboard that goes with it, and 5-10 minutes later, he wakes up on his own. Now, I have to stop it after use and each time only. The Major pain. Any help would be greatly appreciated.
Please test after taking each of the steps that you have already tried:
Step 1
Take all of the measures suggested in this support article, including those under the title "If the previous steps do not work." It is the starting point for a new effort to solve the problem.
Note that, as stated in the article, the computer will not sleep, if some sharing services are enabled. In the menu bar, select
▹ System Preferences... ▹ Sharing
Disable all sharing services.
Step 2
If sharing music iTunes home sharing is enabled, disable it or quit iTunes. Do the same with third-party applications that have a similar feature.
Step 3
Select
▹ System Preferences... ▹ Accessibility ▹ Speakable Items: Off
Step 4
Select
▹ System Preferences... ▹ ▹ Advanced Bluetooth...
and uncheck the two boxes marked
Open Bluetooth Setup Assistant at startup if...
Step 5
Step 6
Back up all data.
Triple-click on the line below on this page to select, then copy the text to the Clipboard by pressing Control-C key combination:
/var/vm
In the Finder, select
Go ▹ go to the folder...
from the menu bar and paste it into the box that opens by pressing command + V. You won't see what you pasted a newline being included. Press return.
A folder named 'vm' should open. Inside, there may be a file named 'drag '. Move this file and only this one in the trash, but do not yet empty. You will be asked for your password. Close the folder window.
Restart the computer and empty the trash.
-
Hello
I have an obligation to appoint all transactions in a store except inversions. So I wrote the query as follows
with trn as ( select 1 t_key, 1 invoice#, 'A' Client, 'P1' Product, 'N' reversal from dual union all select 2 t_key, 2 invoice#, 'B' Client, 'P1' Product, 'N' reversal from dual union all select 3 t_key, 3 invoice#, 'C' Client, 'P1' Product, 'N' reversal from dual union all select 4 t_key, 3 invoice#, 'C' Client, 'P1' Product, 'Y' reversal from dual ), rev_t as (select distinct invoice# from trn where reversal = 'Y') select * from trn where not exists (select 'x' from rev_t where rev_t.invoice# = trn.invoice#);
But in the real world scenario I table of 120 million transactions. If you notice that I consulted trn table 2 times - once in rev_t and the other in the main query. This causes a problem of enormous performance for me. Could you please suggest better otherwise if while accessing to trn don't table only once.
Use Analytics:
with NRT as)
Select 1 t_key, 1 invoice #, 'A' customer, the product "P1", "n" everyone inversion the double union
Select 2-t_key, 2 invoice #, Client "B", "P1" product, inversion of "n" of all the double union
Select 3-t_key, 3 invoice #, customer 'C', 'P1' product, inversion of "n" of all the double union
Select 4 t_key, 3 invoice #, 'C' Client, produces 'P1', 'Y' reversal of the double
),
rev_t like)
Select trn.*,
Max (case inversion when 'Y' then 1 else 0 end) on y_flag (partition of invoice #)
NRT
)
Select t_key,
Invoice #.
customer,
product,
reversal
of rev_t
where y_flag = 0
/
T_KEY INVOICE # C PR R
---------- ---------- - -- -
1 1 N P1
2 2 N P1SQL >
And if the reversal can be only Y/N or null:
with NRT as)
Select 1 t_key, 1 invoice #, 'A' customer, the product "P1", "n" everyone inversion the double union
Select 2-t_key, 2 invoice #, Client "B", "P1" product, inversion of "n" of all the double union
Select 3-t_key, 3 invoice #, customer 'C', 'P1' product, inversion of "n" of all the double union
Select 4 t_key, 3 invoice #, 'C' Client, produces 'P1', 'Y' reversal of the double
),
rev_t like)
Select trn.*,
Max (Reversal) on y_flag (partition of invoice #)
NRT
)
Select t_key,
Invoice #.
customer,
product,
reversal
of rev_t
where y_flag = ' don't
/
SY.
-
Using an NDS for an unfavorable SQL executed only once in a proceudure
Hello
We are using Oracle 11.1.0.7.0.
I go through the code written by someone else. In this package they use NDS for each SQL call if it is called several times, or only once. Is it a good thing?
I thought that NDS has been reserved for SQL statements that over and over again in a possible procedure called variant "WHERE clause" variables and so on...
Is there AN advantage to using NDS for SQL queries called only once in a procedure?
Thank youThere is no benefit unless you want to convert PL/SQL SQL * more (analyze once, run once)
There are procedures to ensure: analysis at compile time, run many times.
The code turns in his own foot.Or the developer must have got hold of the unpublished book one chapter of Tom Kyte "how to write impassable applications."
---------
Sybrand Bakker
Senior Oracle DBA -
SQL Query - where where cause exists only once...?
I have a query/set result that I'm trying to / query filter.
What I need is, in two of the 5 columns in the result set, I need to return where registration exists only once. The other 3, they must meet certain criteria.
So, logically, it would be true for all: give me results where results in column 1, 2 there is only once AND Column3 is null and Column3 is null, and column 5 = Server
Not sure if that sense...? :/
one
Published by: Topher34 on March 11, 2010 16:18Try this way:
SQL> select id_user 2 from tbl1 3 group by id_user 4 having count(*)=1 and max(group_name) is null and max(nm_privilege) is null; ID_USER -------------------- AR55245 ASHARMA ADENYSENKO AREEFULLAH
Your qery becomes:
with tbl1 as ( select acct.id_user,sys.system_name,sys.fl_system_type,gu.group_name,obj.nm_privilege from acct left join gu on acct.id_user=gu.grantee and acct.system_id=gu.system_id left join sys on sys.system_id=acct.system_id left join obj on obj.grantee=acct.id_user and obj.system_id=acct.system_id ) select id_user from tbl1 group by id_user having count(*)=1 and max(group_name) is null and max(nm_privilege) is null
Max
http://oracleitalia.WordPress.com -
After migration, iPhoto again takes massive space on the hard drive? My system is showing iphoto and photos with more than 100 GB of space each. I once picture is merged uses always massive GB of space? Thank you.
# Multimedia files are hardlinked.
(141516)
Maybe you are looking for
-
I use a HP Officejet 8600 pro, I am running Windows 7 64 bit. I have no error message when I send the e-mail, it just never happens. My e-mail program (link century Mail) indicates that the message has been sent correctly. This is a new printer, a
-
OK, so I need DirectX 0.9 c to the game red alert 3, but I can't on the new directx installed on my computer because of this errorA .cab file needed for installation is not reliable. Please check Cryptographic Services are enabled and the certificate
-
My computer is to launch my a note that I have another computer on my network using the IP, I do not understand. I have a stereo Kardon Karmon, a drive Sony DVD with WIFI and a printer with WIFI. 2 mobile phones and that's it. All meant to share my h
-
No Audio device - drivers were uninstalled and reinstalled but stil not working not
I have a problem on a customers that all system drivers are installed but the audio does not work - all I get is 'no Audio device '. Unfortunately, I already tried all the registry editing that I found on other sites and also uninstall and reinstall
-
NO access to 1.90 MB 2 GB Sansa M250 Player/Any advice appreciated
Hello! Thank you for reading my question. I have a sansa m250 2 GB with reader, but when I put in there songs I can only access to 230 MEgabyles!. Once he reached 230 MB, I get an error message that the other songs cannot be copied. How can I access