Copied to clipboard

Flag this post as spam?

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


  • Volodymyr 8 posts 88 karma points
    Dec 13, 2016 @ 12:46
    Volodymyr
    0

    Unique Content in Numeric property

    Hello, I need simplest solution for my problem,thats why i will be very appreciate if you help me. How i can add unique value to the node(numeric property), check if this value is exist in the other nodes(with same document Type) and after return something like that "ticket ID is a duplicate with ..." .

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Dec 13, 2016 @ 14:39
    Alex Skrypnyk
    0

    Hi Volodymyr,

    Try to use ExamineManager, it's the fastest way to get all nodes by docType alias:

    var query = ExamineManager.Instance.CreateSearchCriteria()
                          .NodeTypeAlias("yourDocumentType")
                          .Compile();
    
    IEnumerable<IPublishedContent> myNodes = Umbraco.TypedSearch(query);
    

    After that select with LINQ or pure c# node with value what you want to check.

    I hope it will help you.

    Thanks,

    Alex

  • Volodymyr 8 posts 88 karma points
    Dec 13, 2016 @ 15:31
    Volodymyr
    0

    Perhaps I didn't explain myself properly. I need to "validate" when some "editor" put in numeric property(in document type) not unique value and handle it without publish...

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Dec 13, 2016 @ 15:47
    Alex Skrypnyk
    1

    Volodymyr, as I see the solution, you have to create a handler and call in after editor added a new number.

    Just check is there such number in the system with code that I provided to you and allow to save new value after that.

    Is it make sense ?

    Thanks,

    Alex

  • Volodymyr 8 posts 88 karma points
    Dec 13, 2016 @ 16:23
    Volodymyr
    0

    It's make sense but anyway i have problem with handler, because i don't have any opportunities to use visual studio. But thank you for helping.

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Dec 26, 2016 @ 16:33
    Alex Skrypnyk
    0

    I hope we will find solution.

    Is it solved issue now?

  • Volodymyr 8 posts 88 karma points
    Dec 26, 2016 @ 22:15
    Volodymyr
    0

    As for me, this issue not solved.. because i didn't find solution which work for me. But it's already nesesery.

Please Sign in or register to post replies

Write your reply to:

Draft