This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with retrieving UNSRootB object

When I invoked code:

If Session.Source.TryGet( Query.From("UNSRootB") _ 
                               .Where(f.UidComparison("UID_UNSRootB", UID_UNSRootB, CompareOperator.Equal)) _
                               .SelectNonLobs, UNSRootB )
    ...
End If

TryGet results with False (object could not be found).

On the other hand when I execute SQL query:

SELECT * FROM UNSRootB WHERE UID_UNSRootB = '<UID_UNSRootB>'

it returns one row.

IDM ver. 7.1.2

Parents
  • Your script works for me in either case, using an Ident_UNSRoot or an UID_UNSRootB.

    The only suggestion I have is to replace the f.Comparison method with an f.UidComparison method. It might be a rare case, but the generated where-clauses are different.

    Your comparison method generates a where-clause like

    UID_UNSRootB = N'<UID_UNSRootB>'

    while UidComparison generates

    UID_UNSRootB = '<UID_UNSRootB>'

    In version 7 and above, all UIDs are Non-Unicode so the second where clause is the correct one.

    Bonus:

    .Where(f.UidComparison("UID_UNSRootB", UID_UNSRootB) ) _

    is shorter as well :-)

Reply
  • Your script works for me in either case, using an Ident_UNSRoot or an UID_UNSRootB.

    The only suggestion I have is to replace the f.Comparison method with an f.UidComparison method. It might be a rare case, but the generated where-clauses are different.

    Your comparison method generates a where-clause like

    UID_UNSRootB = N'<UID_UNSRootB>'

    while UidComparison generates

    UID_UNSRootB = '<UID_UNSRootB>'

    In version 7 and above, all UIDs are Non-Unicode so the second where clause is the correct one.

    Bonus:

    .Where(f.UidComparison("UID_UNSRootB", UID_UNSRootB) ) _

    is shorter as well :-)

Children
No Data