DecideJoinType()

Summary

Determines if the right fields of a join have duplicates for aggregation.

Syntax

type = DecideJoinType(string join_fld, array options)

Argument Contents
join_fld The field spec of the join field
Option Type Contents
Zero as Missing Boolean Whether to treat zeroes as missing values

Returns

The string "A" if duplicates are found, null otherwise.

Notes

  • DecideJoinType() returns "A" when JoinViews() or JoinViewsMulti() function with the "A?" option would create an aggregate join, rather than a one-to-one join.

  • Just as in JoinViews() or JoinViewsMulti(), the existence of duplicates is based on a partial reading, rather than examining the entire table.

Example

// See if there are many sales records per state
type = DecideJoinType("Sales.State", {"zero as missing", "True"})
if type = "A" then title = "Accumulated sales per state"
else title = "Sales per state"
// Now link the Sales table to the table of states
new_view = JoinViews("StateSales", "[U.S. States].Name", "Sales.State", {{type}})
// Show the resulting table with the appropriate title
CreateEditor(title, new_view + "|", , )

Error Codes

Error Type Meaning
Error No field provided; invalid field specification
Escape The user interrupted the sorting of the right field
NotFound The field is not found

See Also

Function Summary
JoinViews() Creates a joined view by linking fields in two existing views
JoinViewsMulti() Creates a joined view by linking multiple fields in two existing views