Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FORMAT() for Currency fields #74

Open
aranwe opened this issue Jul 25, 2021 · 2 comments
Open

Support FORMAT() for Currency fields #74

aranwe opened this issue Jul 25, 2021 · 2 comments

Comments

@aranwe
Copy link
Contributor

aranwe commented Jul 25, 2021

Currently if you try to add Query.selectField('FORMAT(Amount) Amount') the Query formating fails on:
checkFieldLevelSecurity(Schema.SObjectType objType, String fieldPath) because it tries to get the whole String from fieldMap.

FunctionFieldTuples are supported only in aggregate queries.

Either there should be regexp that would support FORMAT() in checkFieldLevelSecurity or there should be some more advanced mechanism to allow FunctionFieldTuples in non-aggregation queries ... though SOQL supports only FORMAT() as function call in non-aggregation queries?

What do you think?

Cheers,
O.

@HenryRLee
Copy link
Contributor

Hi @aranwe, I think we should allow FunctionFieldTuple in non-aggregation queries. Actually, I believe if we add a function that does functionFieldList.add(new FunctionFieldTuple('FORMAT', field, alias)), it will work. It's just the method name formAggregateString creates confusion and makes people think FunctionFieldTuple are only used in aggregation queries. So it'd be better if we rename the method name also.

Do you want to work on a PR for this?

@aranwe
Copy link
Contributor Author

aranwe commented Jul 27, 2021

Oh, you're right, I haven't noticed that the formAggregateString is called in all Query Strings (as long as there are functionFields). Thought there was separate method for aggregation queries and normal for some reason. :)
Then yeah, it makes sense.

I can create PR but in ~a month, I'll be OOO, if anyone feels like playing with it - go ahead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants