Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Expression - Evaluate - Very Urgent

Expression - Evaluate - Very Urgent

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sekannak
    wrote on last edited by
    #1

    Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,

    kannak

    N A L 3 Replies Last reply
    0
    • S sekannak

      Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,

      kannak

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Marking your post as Very Urgent is very rude around here. It may be urgent to you but everyone here volunteers their time, it's not urgent to them


      only two letters away from being an asset

      1 Reply Last reply
      0
      • S sekannak

        Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,

        kannak

        A Offline
        A Offline
        Arindam Sinha
        wrote on last edited by
        #3

        Kannak, You menitioned that ROUND,ABS etc you are able to do. So you know the meaning of string "ABS" is the mathematical expression ABS. So you should be knowing the meaning of string "IIF". Based on the meaning you have to implement. Supposr, I think the meaning is the maximum of the 3 values then I would have a function like this -

        /// <summary>
        /// This method returns the max of the 3 values
        /// </summary>
        /// <param name="iifCond">Pass a string like this - "1000,2000,1500"</param>
        /// <returns></returns>
        private int GetValueFromIIF(string iifCond)
        {
        string[] strValues = iifCond.Split(',');
        int[] intValues = new int[3];
        int maxValue = -1;
        for(int i = 0; i < strValues.Length;i++)
        {
        intValues[i] = Convert.ToInt32(strValues[i]);
        if (intValues[i] > maxValue)
        maxValue = intValues[i];
        }
        return maxValue;
        }

        Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this answer.

        1 Reply Last reply
        0
        • S sekannak

          Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,

          kannak

          L Offline
          L Offline
          logiclabz
          wrote on last edited by
          #4

          I hope the below link would help Evaluate expressions in C# .Net

          ----------------- logiclabz

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups