Cannot use from_dataset() with join criteria on capitalized field name

When I try to specify join criteria like this:

from_dataset("Eligibility", "Id", MemberId: MemberId)

it outputs errors:

ClaimId,EligibilityId
1000004,error: Please use field(‘MemberId’) to access MemberId because it starts with an upper case letter.
1001007,error: Please use field(‘MemberId’) to access MemberId because it starts with an upper case letter.

When I change the join criteria as suggested, it outputs different errors:

from_dataset("Eligibility", "Id", field('MemberId'): MemberId)

ClaimId,EligibilityId
1000004,“Syntax error in formula 'from_dataset(”“Eligibility”", ““Id””, field(‘MemberId’): MemberId)’"
1001007,“Syntax error in formula 'from_dataset(”“Eligibility”", ““Id””, field(‘MemberId’): MemberId)’"

There is a test schema here: Test Data Set Join Criteria

In Ruby upper case hash keys require this syntax: “MemberId” => field(“MemberId”)

I must have been fatigued when I posted this because it looks like I put the field() wrapper on the wrong end of the hash key/value pair. Part of my confusion is that I learned in other posts that the right-hand side should not be quoted.

So it should be like this?

from_dataset("Eligibility", "Id", "MemberId" => field('MemberId'))

So the colon is also replaced by the arrow operator in this call to from_dataset() ?

Actually, I was wrong, you can use upper case symbols as hash keys in ruby, so MemberId: field('MemberId') should work find. The only problem was that you needed the field() call on the right side of the hash expression.

As an aside, regarding the arrow syntax, that’s ruby’s original hash syntax and it allows for keys with spaces and other characters. So for example foo: “bar” is equivalent to “foo” => “bar”. You can’t however do:

foo bar: "foo bar"

But you can do:

"foo bar" => "foo bar"

Just one of the many idiosyncrasies of ruby.

1 Like