
Hi,
1) What is the difference between SysQuery and SysQueryRangeUtil and when to use each one?
2) what is the difference between SysQuery::Range and SysQueryRangeUtil::dataRange
3) what is the difference between add range and findOrCreate range and when to use each one
Hi IntegrationBeginner,
I think most of your questions can be best answered by opening the AOT. It offers great documentation about many standard objects.
1) They are two different classes, you can actually see the full source code in AOT and find all the differences. You can select one that suits your requirement. If both suit your requirement, you can use either one. You can use cross references to see how they're used in the system
2) There's no method "dataRange" in SysQueryRangeUtil. Perhaps you mean "dateRange"? Anyway, you can actually find full XML documentation of both functions in AOT right above the method declaration.
3) addRange always adds a new range. findOrCreateRange finds existing range for provided table field, and creates a new one if it doesn't exist. You should use addRange if you want to add multiple ranges for same field. You should use findOrCreateRange if you want to replace possibly existing range for the field (avoid having multiple OR ranges for same field). If you have just created a query in x++ and just want to add one range, you can use either one.