Search Results

Search found 4498 results on 180 pages for 'expression'.

Page 37/180 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • IF expression in SQL

    - by chupinette
    INSERT INTO item_quotation (item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) SELECT DISTINCT I.item_id," . $quotation_id . ",T.item_name, I.name,I.other_name, INV.selling_price, I.discounted_price FROM temp_quotations T, item I, inventory INV<br/> WHERE ( I.name LIKE CONCAT( '%', T.item_name, '%' ) OR I.other_name LIKE CONCAT( '%', T.item_name, '%' )) AND INV.item_id = I.item_id; I have a table called temp_quotations(temp_item_id,item_name)having values (1,grinder), (2,drill), (3,kit) I have another table called item(item_id,name,other_name,discounted_price) having values (1,grinder A,100),(2,kit A,200) When I execute this sql, it insert values in table item_quotation(item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) for example in this case it will insert (1,1,grinder,grinder A,150,100) (2,1,kit,kit A, 250,200) Since the item drill is not found in table item, it wont display it in table item_quotations. I want to write an if statement within that sql so that when the item_name from temp_quotation does not match the name from item, it displays not found in the place of item_name. This is what i tried but it does not display "not found": INSERT INTO item_quotation (item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) SELECT DISTINCT I.item_id," . $quotation_id . ",T.item_name, IF(I.name LIKE CONCAT( '%', T.item_name, '%' ),I.name,'not found'),I.other_name, INV.selling_price, I.discounted_price FROM temp_quotations T, item I, inventory INV WHERE ( I.name LIKE CONCAT( '%', T.item_name, '%' ) OR I.other_name LIKE CONCAT( '%', T.item_name, '%' )) AND INV.item_id = I.item_id;

    Read the article

  • regular expression help

    - by hao
    <li class="zk_list_c2 f_l"><a title="abc" target="_blank" href="link"> abc </a>&nbsp;</li> how would i extract abc and link? $pattern="/<li class=\"zk_list_c2 f_l\"><a title=\"(.*)\" target=\"_blank\" href=\"(.*)\">\s*(.*)\s*<\/a>&nbsp;<\/li>/m"; preg_match_all($pattern, $content, $matches); the one i have right now doesnt seems to work

    Read the article

  • regular expression help

    - by JPro
    I always get confused using regular expressions. Can anyone please suggest me a tutorial? I need help with checking for a string which, cannot contain any wild characters except colon, comma, full stop. It will be better to replace these if found. Any help? Thanks.

    Read the article

  • Need help with using regular expression in Java

    - by richard
    Hi, I am trying to match pattern like '@(a-zA-Z0-9)+ " but not like 'abc@test'. So this is what I tried: Pattern MY_PATTERN = Pattern.compile("\\s@(\\w)+\\s?"); String data = "[email protected] #gogasig @jytaz @tibuage"; Matcher m = MY_PATTERN.matcher(data); StringBuffer sb = new StringBuffer(); boolean result = m.find(); while(result) { System.out.println (" group " + m.group()); result = m.find(); } But I can only see '@jytaz', but not @tibuage. How can I fix my problem? Thank you.

    Read the article

  • Nhibernate criteria query inserts an extra order by expression when using JoinType.LeftOuterJoin and Projections

    - by Aaron Palmer
    Why would this nhibernate criteria query produce the sql query below? return Session.CreateCriteria(typeof(FundingCategory), "fc") .CreateCriteria("FundingPrograms", "fp") .CreateCriteria("Projects", "p", JoinType.LeftOuterJoin) .Add(Restrictions.Disjunction() .Add(Restrictions.Eq("fp.Recipient.Id", recipientId)) .Add(Restrictions.Eq("p.Recipient.Id", recipientId)) ) .SetProjection(Projections.ProjectionList() .Add(Projections.GroupProperty("fc.Name"), "fcn") .Add(Projections.Sum("fp.ObligatedAmount"), "fpo") .Add(Projections.Sum("p.ObligatedAmount"), "po") ) .AddOrder(Order.Desc("fpo")) .AddOrder(Order.Desc("po")) .AddOrder(Order.Asc("fcn")) .List<object[]>(); SELECT this_.Name as y0_, sum(fp1_.ObligatedAmount) as y1_, sum(p2_.ObligatedAmount) as y2_ FROM fundingCategories this_ inner join fundingPrograms fp1_ on this_.fundingCategoryId = fp1_.fundingCategoryId left outer join projects p2_ on fp1_.fundingProgramId = p2_.fundingProgramId WHERE (fp1_.recipientId = 6 /* @p0 */ or p2_.recipientId = 6 /* @p1 */) GROUP BY this_.Name ORDER BY p2_.name asc, y1_ desc, y2_ desc, y0_ asc It is incorrectly putting the p2_name asc into the ORDER BY statement, and causing it to crash. This only happens when I use JoinType.LeftOuterJoin on my Projects criteria. Is this a known nhibernate bug? I'm using nhibernate 2.0.1.4000. Thanks for any insight.

    Read the article

  • can't insert xml dml expression as a string

    - by 81967
    Here is the code below that would explain you the problem... I create a table below with an xml column and declare a variable, initialize it and Insert the Value into the xml column, create table CustomerInfo (XmlConfigInfo xml) declare @StrTemp nvarchar(2000) set @StrTemp = '<Test></Test>' insert into [CustomerInfo](XmlConfigInfo) values (@StrTemp) Then comes the part of the question,, if I write this... update [CustomerInfo] set XmlConfigInfo.modify('insert <Info></Info> into (//Test)[1]') -- Works Fine!!! but when I try this, set @StrTemp = 'insert <Info></Info> into (//Test)[1]' update [CustomerInfo] set XmlConfigInfo.modify(@StrTemp) -- Doesn't Work!!! and throws an error The argument 1 of the xml data type method "modify" must be a string literal. is there a way around for this one? I tried this, but it is not working :(

    Read the article

  • MS Sql Full-text search vs. LIKE expression

    - by Marks
    Hi. I'm currently looking for a way to search a big database (500MB - 10GB or more on 10 tables) with a lot of different fields(nvarchars and bigints). Many of the fields, that should be searched are not in the same table. An example: A search for '5124 Peter' should return all items, that ... have an ID with 5124 in it, have 'Peter' in the title or description have item type id with 5124 in it created by a user named 'peter' or a user whose id has 5124 in it created by a user with '5124' or 'peter' in his street address. How should i do the search? I read that the full-text search of MS-Sql is a lot more performant than a query with the LIKE keyword and i think the syntax is more clear, but i think it cant search on bigint(id) values and i read it has performance problems with indexing and therefore slows down inserts to the DB. In my project there will be more inserting than reading, so this could be a matter. Thanks in advance, Marks

    Read the article

  • I'm trying to use a regular expression to retrieve text from RichTextBox

    - by Simon
    Hello! As the header is implying I'm trying to retrieve a certain line of numbers from a richtextbox and then put it into a separate textbox. I've tried this code below but it doesn't wanna work with me. It's probably way wrong and there's probably easier ways of doing it but I'm quite new to this stuff and I would appreciate all the help I can get in this matter. I have a textbox called tbPersNr; A RichTextBox called tbText; A button which is called btnGet; string regPattern = @"\\d{6}-\\d{4}"; int indexOfSearch = 0; private void btnGet_Click(object sender, EventArgs e) { int startIndex = 0; if (tbText.Text.Length > 0) { startIndex = HittaPersNr(regPattern, startIndex, tbText.Text.Length); } if (startIndex > 0) { this.tbPersNr.Text = regPattern.ToString(); } } public int HittaPersNr(string txtToSearch, int searchStart, int searchEnd) { // Setting default value to -1. int retVal = -1; // Validating start of the search // om indexOfSearch = -1, slutar sökningen if (searchStart >= 0 && indexOfSearch >= 0) { // Validating end of search if (searchEnd > searchStart || searchEnd == -1) { // Searching for results in richtextbox indexOfSearch = tbText.Find(regPattern, searchStart, searchEnd, RichTextBoxFinds.None); // Validating if search resulted in any finds. if (indexOfSearch != -1) { // putting index to value in the text. retVal = indexOfSearch; } } } return retVal; } } } Cheers

    Read the article

  • Javascript expression to define object's property name?

    - by Kirzilla
    Hello, I'd like to create this object... object = { 'object[1][var_name_1]' : 'value1', 'object[1][var_name_2]' : 'value2', }; I'm trying to it this way, but I'm getting error missing : after property id... function getPrefix() { return 'object[1]'; } object = { getPrefix() + '[var_name_1]' : 'value1', getPrefix() + '[var_name_2]' : 'value2', } What am I doing wrong? Or maybbe it is impossible to set object property name using js experession? Thank you

    Read the article

  • Shorter Binding expression with validation

    - by Andrii V
    Hi, I'm repeating same binding parameters for every textbox and they're quite long strings (which is not good for many reasons). And I'm wondering if there's a way to make them shorter? For instance all my controls on forms are using the following binding template: Text="{Binding SourceProperty, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" I'd would like to have something shorter that ideally will take SourceProperty as parameter. Possbly like this: Text="{MyBinding SourceProperty}" or Text="{Binding SourceProperty, Params=MyParams}" One possible option would be to inherit from Binding and create new markup extension. Did someone tried this? Any other ideas how to make these repetetive bindings look better?

    Read the article

  • Regular Expression Help - Brackets within brackets

    - by adbox
    Hello I'm trying to develop a function that can sort through a string that looks like this: Donny went to the {park|store|{beach with friends|beach alone}} so he could get a breath of freash air. What I intend to do is search the text recursively for {} patterns where there is no { or } inside the {}, so only the innermost sandwiched text is selected, where I will then run a php to array the contents and select one at random, repeating process until the whole string has been parsed, showing a complete sentence. I just cannot wrap my head around regular expressions though. Appreciate any help!

    Read the article

  • Excel Matching problem with logic expression

    - by abelenky
    (I understand Excel is only borderline programming) I have a block of data that represents the steps in a process and the possible errors: ProcessStep Status FeesPaid OK FormRecvd OK RoleAssigned OK CheckedIn Not Checked In. ReadyToStart Not Ready for Start I want to find the first Status that is not "OK". I have attempted this: =Match("<>""OK""", StatusRange, 0) which is supposed to return the index of the first element in the range that is NOT-EQUAL (<) to "OK" But this doesn't work, instead returning #N/A. I expect it to return 4 (index #4, in a 1-based index, representing that CheckedIn is the first non-OK element) Any ideas how to do this?

    Read the article

  • JSP: EL expression is not evaluated

    - by James
    I have a JSP page running on Tomcat 5.5. I have the following code: <c:forEach var="i" begin="1" end="10" step="1"> <c:out value="${i}" /> <br /> </c:forEach> The output I am getting is: ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} ${i} I cant work out why the forEach loop is working but the output is not working. Any help any one could give would be great.

    Read the article

  • Regular expression for parsing CSV in PHP

    - by Discodancer
    I already managed to split the CSV file using this regex: "/,(?=(?:[^\"]\"[^\"]\")(?![^\"]\"))/" But I ended up with an array of strings that contain the opening and ending double quotes. Now I need a regex that would strip those strings of the delimiter double quotes. As far as I know the CSV format can encapsulate strings in double quotes, and all the double quotes that are already a part of the string are doubled. For example: My "other" cat becomes "My ""other"" cat" What I basically need is a regex that will replace all sequences of N doublequotes with a sequence of (N/2 - rounded down) double quotes. Or is there a better way ? Thanks in advance.

    Read the article

  • Regular expression of unicode characters on string

    - by Marcus King
    I'm working in c# doing some OCR work and have extracted the text I need to work with. Now I need to parse a line using Regular Expressions. string checkNum; string routingNum; string accountNum; Regex regEx = new Regex(@"\u9288\d+\u9288"); Match match = regEx.Match(numbers); if (match.Success) checkNum = match.Value.Remove(0, 1).Remove(match.Value.Length - 1, 1); regEx = new Regex(@"\u9286\d{9}\u9286"); match = regEx.Match(numbers); if(match.Success) routingNum = match.Value.Remove(0, 1).Remove(match.Value.Length - 1, 1); regEx = new Regex(@"\d{10}\u9288"); match = regEx.Match(numbers); if (match.Success) accountNum = match.Value.Remove(match.Value.Length - 1, 1); The problem is that the string contains the necessary unicode characters when I do a .ToCharArray() and inspect the contents of the string, but it never seems to recognize the unicode characters when I parse the string looking for them. I thought strings in C# were unicode by default.

    Read the article

  • How to evaluate a custom math expression in Python

    - by taynaron
    I'm writing a custom dice rolling parser (snicker if you must) in python. Basically, I want to use standard math evaluation but add the 'd' operator: #xdy sum = 0 for each in range(x): sum += randInt(1, y) return sum So that, for example, 1d6+2d6+2d6-72+4d100 = (5)+(1+1)+(6+2)-72+(5+39+38+59) = 84 I was using regex to replace all 'd's with the sum and then using eval, but my regex fell apart when dealing with parentheses on either side. Is there a faster way to go about this than implementing my own recursive parsing? Perhaps adding an operator to eval?

    Read the article

  • Regular expression literal

    - by Marcus
    As I'm RegEx dyslexic.. what RegEx can you use to find each of the following strings - with the exception of "LoginException"? NullPointerException LoginException BooException Abc123Exception

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >