Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott Devine 8 posts 73 karma points
    Feb 25, 2016 @ 21:49
    Scott Devine
    0

    Querying Decimal field with greater than 0

    I have a property alias rentalCost which has a data type of Umbraco.Decimal and want to select all Items that are not null or greater than 0

    Umbraco.Content(startNodeId).Children.Where("rentalCost > 0")
    

    I can do this with Umbraco.Integer but not with Umbraco.Decimal

    Any ideas on how to do this with Decimal?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 25, 2016 @ 22:01
    Dennis Aaen
    0

    Hi Scott,

    Just curious which data type did you use for the decimal integer on your document types.

    /Dennis

  • Scott Devine 8 posts 73 karma points
    Feb 25, 2016 @ 22:12
    Scott Devine
    0

    Hi Dennis

    I just realised I had Digital instead of Decimal....

    I am using Umbraco.Decimal as the data type...

    I can use the query shown above for Integers but want an equivalent for Decimal

    I am on Umbraco version 7.4.1 assembly: 1.0.5891.23238

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 25, 2016 @ 22:56
    Dennis Aaen
    0

    Hi Scott,

    Okay then you can do something like this.

    Umbraco.Content(startNodeId).Children.Where("rentalCost.ToString() != @0","0")
    

    Hope this helps,

    /Dennis

  • Scott Devine 8 posts 73 karma points
    Feb 25, 2016 @ 23:28
    Scott Devine
    0

    Hi Dennis

    That works!

    Can you tell me why Integer works with greater than and Decimal doesn't?

    I was looking at updating this to do a range search going forward any advice on how to go about this?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies