Search Results

Search found 23568 results on 943 pages for 'select'.

Page 4/943 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Excel VBA Select Case Loop Sub

    - by Zack
    In my excel file, I have a table setup with formulas. with Cells from Range("B2:B12"), Range ("D2:D12"), and etc every other row containing the answers to these formulas. for these cells (with the formula answers), I need to apply conditional formatting, but I have 7 conditions, so I've been using "select case" in VBA to change their interior background based on their number. I have the select case function currently set up within the sheet code, as opposed to it's own macro Private Sub Worksheet_Change(ByVal Target As Range) Dim iColor As Integer If Not Intersect(Target, Range("B2:L12")) Is Nothing Then Select Case Target Case 0 iColor = 2 Case 0.01 To 0.49 iColor = 36 Case 0.5 To 0.99 iColor = 6 Case 1 To 1.99 iColor = 44 Case 2 To 2.49 iColor = 45 Case 2.5 To 2.99 iColor = 46 Case 3 To 5 iColor = 3 End Select Target.Interior.ColorIndex = iColor End If End Sub but using this method, you must be actually entering the value into the cell for the formatting to work. which is why I want to write a subroutine to to do this as a macro. I can input my data, let the formulas work, and when everything is ready, I can run the macro and format those specific cells. I want an easy way to do this, obviously I could waste a load of time, typing out all the cases for every cell, but I figured it'd be easier with a loop. how would I go about writing a select case loop to change the formatting on a a specific range of cells every other row? thank you in advance.

    Read the article

  • ibm informix spatial datablade select statement error

    - by changed
    Hi I am using IBM informix spatial datablade module for some geo specific data. I am trying to find points in table xmlData lying in a specified region. But i am getting this error for select statement. SELECT sa.pre, sa.post FROM xmlData sa WHERE ST_Contains( ST_PolyFromText('polygon((2 2,6 2,6 6,2 6,2 2))',6),sa.point) Query: select count(*) as mycnt fromText('polygon((2 2,6 2,6 6,2 6,2 2))',6),sa.point) Error: -201 [Informix][Informix ODBC Driver][Informix]A syntax error has occurred. (SQLPrepare[-201] at /work/lwchan/workspace/OATPHPcompile/pdo_informix/pdo_informix/informix_driver.c:131) If any one can help me with this. CREATE TABLE xmlData (row_id integer NOT NULL, x integer, y integer, tagname varchar(40,1), point ST_POINT ); EXECUTE FUNCTION SE_CreateSRID(0, 0, 250000, 250000, "use the return value in next query last column"); INSERT INTO geometry_columns (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, geometry_type, srid) VALUES ("mydatabase", -- database name "informix", -- user name "xmlData", -- table name "point", -- spatial column name 1, -- column type (1 = point) 6); -- srid //use value returned by above query. INSERT INTO xmlData VALUES ( 1, 20,20, 'country', ST_PointFromText('point (20 20)',6) ); INSERT INTO xmlData VALUES ( 1, 12,13, 'sunday', ST_PointFromText('point (12 13)',6) ); INSERT INTO xmlData VALUES ( 1, 21,22, 'monday', ST_PointFromText('point (21 22)',6) ); SELECT sa.pre, sa.post FROM xmlData sa WHERE ST_Contains( ST_PolyFromText('polygon((1 1,30 1,30 30,1 30,1 1))', 6),sa.point); I am using following query as reference "ibm link". SELECT name, type, zone FROM sensitive_areas WHERE SE_EnvelopesIntersect(zone, ST_PolyFromText('polygon((20000 20000,60000 20000,60000 60000,20000 60000,20000 20000))', 5));

    Read the article

  • by jquery, set to option of html-select element selected atribude by text, not value

    - by loviji
    hello. I have a select element. <select class='cSelectType'> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> <option value="5">five</option> </select> i can by jquery set option value selected like this: $('.cSelectType option[value=4]').attr('selected', 'selected'); And select element will show "Four". By i wont something like this: $('.cSelectType option[xxx=Four]').attr('selected', 'selected'); i.e By text set selected attribute. some ideas please.

    Read the article

  • tsql replace value on select

    - by Zelter Ady
    I have a column (SERVICE_ID) in my table where I can have only 3 values: 0, 1 and 2. I'd like on select, on displayed result table, to change those value with some english words. select client, SERVICE_ID from customers displays now: -------------------------- | John | 1 | Mike | 0 | Jordan | 1 | Oren | 2 -------------------------- I'd like to change the query to get: -------------------------- | John | QA | Mike | development | Jordan | QA | Oren | management -------------------------- There is any way to do this using only the select?

    Read the article

  • Java: JPQL select statement

    - by bguiz
    select x from X x where x.a.id = :a_id -- Always 0 objects selected Why does the above JPQL statement not work, but the one below work? select a from A a where a.id = :a_id -- a_obj select x from X x where x.a = :a_obj -- Always correct number of objects selected Neither query throws an exception during execution, but a different number of results are obtained. Thanks

    Read the article

  • How can I return a sql select into a sql variable

    - by Matt
    Hi, I'm trying to put the results of a SELECT into a variable and loop through the results to manipulate that data, all in the same stored proceedure... Here's what I have so far: DECLARE @i int @Result = (SELECT * FROM UserImport) SET @i = 0 WHILE @i < (SELECT Count(@Result) As Count) BEGIN /* Do Stuff */ END I know I'm way off because it's saying @Result was not declared, but I'm not sure how to declare a variable to be able to hold the results of a SELECT statement. Can anyone tell me where i'm going wrong and how to fix it? Thanks, Matt

    Read the article

  • Clear Select options when selecting one field while using multiple forms on same page

    - by Nizam
    Hi all, I have a situation where the second select list option is generated from the first select list selected option. Like when we select Country corresponding states are generated in next select list. In my case I am having multiple forms on single page which are same. Can anyone let me know how to implement it on multiple forms. I tried the following code but it didn't work $(".country").change(function(){ $.get("sample.php?val=" + $(this).val(), function(data){ $(this).parent().next().children('.state').children('option').remove(); $(this).parent().next().children('.state').append(data); }); Waiting for your support thanks in advance

    Read the article

  • Hiding Options of a Select with JQuery

    - by Syed Abdul Rahman
    Okay, let's start with an example. Keep in mind, this is only an example. <select id = "selection1">     <option value = "1" id = "1">Number 1</option>     <option value = "2" id = "2">Number 2</option>     <option value = "3" id = "3">Number 3</option> </select> Now from here, we have a dropdown with 3 options. What I want to do now is to hide an option. Adding style = "display:none" will not help. The option would not appear in the dropdownlist, but using the arrow keys, you can still select it. Essentially, it does exactly what the code says. It isn't displayed, and it stops there. A JQuery function of $("#1").hide() will not work. Plus, I don't only want to hide the option, I want to completely remove it. Any possibility on doing so? Do I have to use parent/sibling/child elements? If so, I'm still not sure how. Any help on this would be greatly appreciated. Thanks.           Another question - It's related Ok, so I found out that there is a .remove() available in JQuery. Works well. But what if I want to bring it back? if(condition)     {     $(this).remove();     } I can loops this. Shouldn't be complicated. But the thing of which I am trying to do is this: Maximum Capacity of Class: (Input field here) Select Room: (Dropdown here) What I'd like for it to do is to update is Dropdown using a function such as .change() or .keyup. I could create the dropdown only after something is typed. At a change or a keyup, execute the dropdown accordingly. But what I am doing is this: $roomarray = mysql_query("SELECT *     FROM         (         SELECT *,         CASE         WHEN type = 'Classroom' THEN 1         WHEN type = 'Computer laboratory' THEN 2         WHEN type = 'Lecture Hall' THEN 3         WHEN type = 'Auditorium' THEN 4         END AS ClassTypeValue         FROM rooms         ) t     ORDER BY ClassTypeValue, maxppl, roomID"); echo "<select id = \"room\">"; while ($rooms = mysql_fetch_array($roomarray)) { ?> <option value=<?php echo $rooms['roomID']; ?> id=<?php echo $rooms['roomID']; ?>><?php echo $rooms['type']; echo "&nbsp;"; echo $rooms['roomID']; echo "&nbsp;("; echo $rooms['maxppl']; echo ")"; ?></option> <?php } echo "</select>"; Yes, I know it is very messy. I plan to change it later on. But the issue now is this: Can I toggle the removal of the options according to what has been typed? Is it possible to do so with a dropdown made from a loop? Because I sure as hell can't keep executing SQL Queries. Or is that even an option? Because if it's possible, I still think it's a bad one.

    Read the article

  • Problems re-populating select options in Rails when form returned with errors

    - by Rick
    I have a form with 2 select options in it -- frequency and duration. When there are errors with the form, and it is returned to the browser, the select options are not re-populated with the selections the user made even though the returned values for those fields match the values of options in the selects. Also, when the form is returned, these fields are not marked as having errors even though their values are blank. Here's the frequency and duration fields in Rails <%= frequency_select c, :frequency %> <%= duration_select c, :duration %> The method for frequency_select is def frequency_select(f, method) options = [["day", 1.day], ["other day", 2.days], ["week", 1.week]] f.select method, options, :include_blank => true end And the method for duration_select is def duration_select(f, method, unit="day" ) values, units = *case unit when "day" : [[[5, 5], [15, 15], [30, 29]], "days"] when "other day" : [[[15, 15], [30, 29], [45,45]], "days"] when "week" : [[[4, 29], [6, 43], [8, 57]], "weeks"] end f.select method, values.map {|(label, i)| ["#{label} #{units}", i.days]}, :include_blank => true end If you enter a value into one or both of these fields and submit the form without completing part of it (any part of it), the form is returned to the user (as would be expected), but the duration and frequency fields are not re-populated with the user's selection. If I add this bit of code to the form <p><%= @challenge.attributes.inspect %></p> I see that this for duration and frequency when the form is returned to the browser: "duration"=>3888000, "frequency"=>172800 These values match values on the options in the select fields. Is there anything special in Rails that needs to be done so that the select fields are re-populated with the user's selections? Any thoughts on what the problem could be or what I should try next? Help is greatly appreciated! -Rick PS If you look at some of the other questions, you'll notice I've asked about this in the past. At one point, I thought the form was returning values for frequency and duration in days rather than seconds, but that's not the case. PPS Here's one other bit of information that might matter, but my tests indicate that it probably does not. (Though, I'm a bit of a newbie to this, so don't take my word for it.) These two fields are chained together using the cascade jquery plugin. The javascript is included on the page (not in a separate file) and some of the js is being created by Rails. First, here are the scripts as they appear in the browser. The first is the script to generate the options for the duration select and the second is the script required by the Cascade plugin to trigger the field chaining. <script type="text/javascript"> var list1 = [ {'When':'86400','Value':' ','Text':' '}, {'When':'172800','Value':' ','Text':' '}, {'When':'604800','Value':' ','Text':' '}, {'When':'86400','Value':'432000','Text':'5 days'}, {'When':'86400','Value':'1296000','Text':'15 days'}, {'When':'86400','Value':'2505600','Text':'30 days'}, {'When':'172800','Value':'1296000','Text':'15 days'}, {'When':'172800','Value':'2505600','Text':'30 days'}, {'When':'172800','Value':'3888000','Text':'45 days'}, {'When':'604800','Value':'2505600','Text':'4 weeks'}, {'When':'604800','Value':'3715200','Text':'6 weeks'}, {'When':'604800','Value':'4924800','Text':'8 weeks'} ]; function commonTemplate(item) { return "<option value='" + item.Value + "'>" + item.Text + "</option>"; }; function commonMatch(selectedValue) { return this.When == selectedValue; }; </script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#challenge_duration, #user_challenge_duration").cascade("#challenge_frequency, #user_challenge_frequency",{ list: list1, template: commonTemplate, match: commonMatch }) }); </script> And here's a bit of the the first script as it is in the erb file -- you see that some of the script is being generated by Rails <%= [ [1.day, [[5, 5], [15,15], [30, 29]], "days"], [2.days, [[15, 15], [30, 29], [45, 45]], "days"], [1.week, [[4, 29], [6, 43], [8, 57]], "weeks"]].map do |(frequency, durations, unit)| durations.map do |(label, value)| "{'When':'#{frequency}','Value':'#{value.days}','Text':'#{label} #{unit}'}" end end.join(",\n") -%> Now, the reason I don't think that it matters whether the duration is being generated with JS is the problem still exists if I remove all the JS the problem also affects the frequency field, whose options are not being generated by the JS

    Read the article

  • How do I pass struts2 <s:select multiple="true"> with a Map

    - by deepblue
    I have an bean placed on my action Event.java, the action is Called ManageEvents. I would like the user to be able to add to a struts2 multiple select form field and create a list or map of items (in this case Map where the data would be . <struts2:select name="event.dj_map" label="Add DJs To Your Event" list="event.dj_map" listsize="5" multiple="true" headerKey="headerKey" required="true" headerValue="--- Please Select ---"> So ultimately I would like to know how to pass a mult. select field (e.g. Events.dj_map) as a map of name,value pairs to an object (e.g. Event.java) set on the action (e.g. ManageEvents.java).

    Read the article

  • Multiple/nested "select where" with Zend_Db_Select

    - by DJRayon
    Hi there I need to create something like this: select name from table where active = 1 AND (name LIKE 'bla' OR description LIKE 'bla') The first part is easy: $sqlcmd = $db->select() ->from("table", "name") ->where("active = ?", 1) Now comes the tricky part. How can I nest? I know that I can just write ->orWhere("name LIKE ? OR description LIKE ?", "bla") But thats wron, because I need to dynamically change all the parts. The query will be built all the time the script runs. Some parts get deleted, some altered. In this example I need to add those OR-s because sometimes I need to search wider. "My Zend Logic" tells me that the correct way is like this: $sqlcmd = $db->select() ->from("table", "name") ->where("active = ?", 1) ->where(array( $db->select->where("name LIKE ?", "bla"), $db->select->orWhere("description LIKE ?", "bla") )) But that doesn't work (atleast I dont remember it working). Please. Can someone help me to find a object oriented way for nesting "where"-s

    Read the article

  • Waiting for data via select not working

    - by BSchlinker
    I'm currently working on a project which involves multiple clients connected to a server and waiting for data. I'm using select and monitoring the connection for incoming data. However, the client just continues to print nothing, acting as if select has discovered incoming data. Perhaps I'm attacking this wrong? For the first piece of data the server does send, it is displayed correctly. However, the server then disconnects and the client continues to spew blank lines. FD_ZERO(&readnet); FD_SET(sockfd, &readnet); while(1){ rv = select(socketdescrip, &readnet, NULL, NULL, &timeout); if (rv == -1) { perror("select"); // error occurred in select() } else if (rv == 0) { printf("Connection timeout! No data after 10 seconds.\n"); } else { // one or both of the descriptors have data if (FD_ISSET(sockfd, &readnet)) { numbytes = recv(sockfd, buf, sizeof buf, 0); printf("Data Received\n"); buf[numbytes] = '\0'; printf("client: received '%s'\n",buf); sleep(10); } } }

    Read the article

  • To check the default select value tag!

    - by Small Wolf
    I have a question.Here is the code! f.select(:departments,Department.all.collect{|c|[c.name,c.id]},{},:size=>10,:multiple => ture) class Emergency has many :departments end the html source like this: <select id="emergency_departments" multiple="multiple" name="emergency[departments][]" size="10"><option value ="">""</option>....</select> now I want to get the default selected tag , who can tell me how ?

    Read the article

  • Create form select from object containing values

    - by marks34
    I have such an object : var options = {1: 'Running', 2: 'Falling', 3: 'Collapsing wall', 4: (...)}; I'd like to create form's select element with ooptions taken from this object, so something like that (code I tried which is not working, but you can get the idea) : html = '<form action="" ><select name="block-action"><option>-------</option>'; for(k in obj){ html += '<option value="'+k+'">'+obj[k]+'</option>' } html += '</select></form>'

    Read the article

  • How do I select an option using Spring's form:select tag?

    - by Dave
    I'm using Spring 3.1.1.RELEASE. Using the form:select tag, how do I specify which option should be selected? I want the first one to be selected, but when I put <form:select path="parentOrganization"> <form:option value="" label="Select an Org Type or Parent Org" /> <form:options items="${orgTypesWoParents}" itemValue="id" itemLabel="description" /> <form:option value="" label="=======================" /> </form:select> the last one is selected. I want to preserve the order of how everything is displayed, which is why I've arranged things in this way.

    Read the article

  • Dojo Select widget validation style

    - by jamstooks
    Many dojo form widgets, like DateTextBox will style themselves in red (claro theme) with an "!" to indicate that the field isn't valid after focus. I can't seem to get this type of styling to work with the Select widget. I have the value set to required, but if the user leaves it in the default state, blank, then it remains unstyled. I tried to test this programmatically: wigs = dijit.findWidgets(node); for( i = 0; i < wigs.length; i++ ) { wigs[i].focus(); } This triggers validation on several other widgets and they are styled appropriately, but not he Select widgets. Anyone know how to make it obvious that those select widgets are not validating? Oh, and wigs[i].isValid() is definitely false for those select widgets.

    Read the article

  • C# Linq Select Problem in Method Chain.

    - by Gnought
    Note that the _src inherit IQueryable<U> and V inherit new(); I wrote the following statement, there is no syntax error. IQueryable<V> a = from s in _src where (s.Right - 1 == s.Left) select new V(); But if i re-wrote it as follows, the Visual Studio editor complains an error in the "Select" IQueryable<V> d = _src.Where(s => s.Right - 1 == s.Left).Select(s=> new V()); The Error is: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. Candidates are: System.Collections.Generic.IEnumerable<V> Select<U,V>(this System.Collections.Generic.IEnumerable<U>, System.Func<U,V>) (in class Enumerable) System.Linq.IQueryable<V> Select<U,V>(this System.Linq.IQueryable<U>, System.Linq.Expressions.Expression<System.Func<U,V>>) (in class Queryable) Could anyone explain this phenomenon, and what the solution is to fix the error?

    Read the article

  • Delete blank row in dropdownlist or select default value in infopath dropdown

    - by KunaalKapoor
    Regular Dropdown (Pulling from DataSource)1. Double click on dropdown field in the data source.2. Select Fx button for Default value.3. Select Insert field or group.4. Select secondary xml from data source.5. Select “value” and click on ok.For a cascading dropdown:You have to add the rule and follow these steps,1. Rules -> ‘Add’ - > ‘Add Action’.2. Select ‘Set a field value’ option in first dropdown in Action.3. Select your field with help of ‘Select a Field or Group’ option in ‘Field’.4. Select your external data source list value in ‘Value’.This rule you can apply in OnLoad or whenever you will get external data source values.

    Read the article

  • Sliding & hiding multiple panels in jQuery.

    - by lloydphillips
    I have a table with multiple rows in each row is a select list and based on the selection (when the onchange event is fired) panels appear containing additional data below the row.I currently have code like this: var allPnls = '.inv-dtl-comnts-add,.inv-dtl-comnts-update'; $(document).ready(function(){ hideAll(); //select action change $(".inv-dtl-ddlaction").change(onSelectChange); $(".btn-cancel").click(function(event){ slideAll(); $(".inv-dtl-ddlaction").val('[Select an Action]'); return false; }); }); function onSelectChange(event){ //find out which select item was clicked switch($(this).val()) { case 'View/Add Comment': $(this).closest(".row").children(allPnls).slideUp("fast", function(){ $(this).closest(".row").children(".inv-dtl-comnts-add").slideToggle("fast"); }); break; case 'Change Status': $(this).closest(".row").children(allPnls).slideUp("fast", function(){ $(this).closest(".row").children(".inv-dtl-comnts-update").slideToggle("fast"); }); break; default: //code to be executed if n is different from case 1 and 2 } } function hideAll(){ $(allPnls).hide(); } function slideAll(){ $(allPnls).slideUp("fast"); } So I'm hiding all the panels when the page loads and if a panel is already open I want to slide it shut before reopening the new panel. This works with the postback. With just one panel in the selection it worked great but with two panels the sliding up happens twice (it seems to slide down unopened panels before sliding them back up again). How can I adjust this so that I can get all panels listed in the variable allPnls to slide shut ONLY if they are already open? Is there a better way of sliding the panels shut and then having a callback to have the slideToggle work? Lloyd

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >