Filter CategoryItemField By Description #.NETAPI

Answered

Comments

4 comments

  • Ajmal v Hassainar

    Hi Thiago,

    You can do the following :

     string categoryText = "Test category 1";
                var podioApp = podio.ApplicationService.GetAppField(123456, 789456);
                var key = podioApp.Config.Settings["options"].FirstOrDefault(x => (string)x["text"] == categoryText)["id"].ToString();
    
    
    1
    Comment actions Permalink
  • Thiago Caldeira

    Hi Ajmal,
    Thank you!
    I Implemented your code and hitherto returns perfectly
    var key = podioApp.Config.Settings["options"]
    But the complete code returns the Error.

    look:

    podioApp.Config.Settings["options"] {[
    {
    "status": "active",
    "text": "Text A ",
    "id": 1,
    "color": "FFD5C2"
    },
    {
    "status": "active",
    "text": "Text B”,
    "id": 5,
    "color": "E1D8ED"
    },
    {
    "status": "deleted",
    "text": " Text C”,
    "id": 2,
    "color": "E1D8ED"
    },
    {
    "status": "deleted",
    "text": "Text D",
    "id": 3,
    "color": "DCEBD8"
    },
    {
    "status": "active",
    "text": "Text E",
    "id": 4,
    "color": "FFD5C2"
    },
    {
    "status": "deleted",
    "text": "Text F",
    "id": 6,
    "color": "DCEBD8"
    },
    {
    "status": "active",
    "text": "Text G",
    "id": 7,
    "color": "F7F0C5"
    }
    ]} Newtonsoft.Json.Linq.JToken {Newtonsoft.Json.Linq.JArray}

    But the complete code returns the Error Following
    podioApp.Config.Settings["options"].FirstOrDefault(x => (string)x["text"] == categoryText)["id"].ToString() Expression cannot contain lambda expressions

    0
    Comment actions Permalink
  • Ajmal v Hassainar

    podioApp.Config.Settings property is a JObject. You can easily query the date with LINQ, Please refer this documentation: http://www.newtonsoft.com/json/help/html/QueryingLINQtoJSON.htm

    0
    Comment actions Permalink
  • Thiago Caldeira

    perfectly ! Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk