Comments (26)
from swiftlysalesforce.
from swiftlysalesforce.
@perbrondum would you post your (formatted) code, please?
from swiftlysalesforce.
private func groupedQuery() throws {
let app = try ConnectedApp()
let soql = """
SELECT activitydate, status, Count(Id) Cnt
FROM task
WHERE isdeleted = false
GROUP BY activitydate, status
"""
// let soql = "SELECT activitydate, status, Count(Id) Cnt FROM task WHERE isdeleted = false GROUP BY activitydate, status"
let pub: AnyPublisher<QueryResult<SObject>, Error> = app.query(soql: soql)
pub.sink { completion in
switch completion {
case let .failure(error):
print("Failed to execute grouped Query. Error: \(error)")
case .finished:
print("Success query")
break
}
} receiveValue: { (tasks: QueryResult<SObject>) in
for task in tasks.records {
print(task.string(forField: "Cnt"))
}
}.store(in: &subscriptions)
}
from swiftlysalesforce.
You get the error when you add the GROUP clause. The count is not really relevant.
from swiftlysalesforce.
Similar results from use of Max in select list (I assume it's using 'group by' internally).
SELECT max(id) MaxId
FROM Account
WHERE isdeleted = false
from swiftlysalesforce.
Thanks @perbrondum - yes, any aggregating function in the query will cause the error. It's my fault - I re-introduced an error in ver. 9 that I had corrected in ver. 7. The current code expects the result to contain an array of records, each with an ID. But Salesforce returns a list of AggregateResult
"records" when an aggregating function is used, and there is no ID. I'll fix it ASAP - trying to decide whether to fix with a breaking change (and update to ver 10) or a non-breaking change.
from swiftlysalesforce.
from swiftlysalesforce.
Is branch V9-fix-135 the fix for the bug?
from swiftlysalesforce.
@perbrondum it is -- but the fix isn't in there yet. I haven't had time yet to implement the fix. If you are blocked by the bug, I will accelerate the fix and try to get it done this week. I will notify you once ready. Thx
from swiftlysalesforce.
from swiftlysalesforce.
Thanks a lot for fixing this. Looks like I was able to pass all our tests with this fix.
from swiftlysalesforce.
@perbrondum good to hear. I didn't have time to test yet - as soon as I have working unit tests (and figure out what's wrong per issue #137 that you opened) I will merge into main branch.
from swiftlysalesforce.
Have you decided on a V9 or V10 release for the fix?
from swiftlysalesforce.
@perbrondum it'll be a minor release, updating version 9. I believe it's ready, but I wanted to do more testing before release. (For version 10, I'm considering a major release, in line with Apple's release of async/await in Swift 5.5.)
from swiftlysalesforce.
from swiftlysalesforce.
Mike - Are you still considering a 9 release for this fix or is it pushed to R10? Thanks.
from swiftlysalesforce.
@perbrondum - the fix will be in version 10. I'm working on v.10 now, writing tests and plan to release it soon.
from swiftlysalesforce.
from swiftlysalesforce.
@perbrondum the major change in v10 will be async/await. I will try to reintroduce SOSL search in v10.0, but if I can't, I'll start working on that for v10.1 as soon as possible. Thanks
from swiftlysalesforce.
Thanks @perbrondum - it's good for me to know what's useful.
from swiftlysalesforce.
Fixed in version 10.0.0
from swiftlysalesforce.
Thank you @perbrondum. I am loving async/await so far - so much simpler to follow, and requires much less code, as you noted. And thanks to the new Actor type, even multiple OAuth requests emanating simultaneously from different places in the code are easily 'bundled' into a single call. (The flip side is that I had to remove, for now at least, the ability to disable the automatic re-authentication -- i.e. no more "allowsLogin" switch in a request. So if you call a Salesforce method and in the unlikely event the refresh token flow fails, the user would be prompted to re-authenticate.)
from swiftlysalesforce.
from swiftlysalesforce.
@perbrondum re. the issues you mentioned:
- Is
TASK
a custom object that you created to represent the Salesforce Task sObject? - I'll be interested to know what you learn about this. I'm using Swiftly Salesforce with SwiftUI on a project, so haven't dealt with UIKit issues.
- I will fix that asap -- please see issue #144 for a workaround in the meantime
Thank you for the feedback.
from swiftlysalesforce.
from swiftlysalesforce.
Related Issues (20)
- Composite resources support HOT 2
- MyRecords() func assumes object has 'ownerId' column HOT 8
- Login migration path for Swift Apps HOT 6
- Support for Anonymous Apex? HOT 7
- Error in fields array: Protocol 'Encodable' as a type cannot conform to the protocol itself HOT 7
- salesforce.search() replacement? in 9.0 HOT 2
- WebAuthenticator.swift:50:30: 'shared' is unavailable in application extensions for iOS HOT 1
- keyNotFound "id" error on simple query HOT 7
- Query with date predicate fail HOT 8
- Minor doc bug HOT 1
- Is there another way to perform salesforce.nextResultPage in V10? HOT 6
- Update links in README.md so they point to latest code version
- Adding SwiftlySalesforce to new project adds V8.0 (master) HOT 4
- Add ability to save files to SFDC & share via Chatter/Slack
- Implementation in ipad Swift Playground. AuthenticationError HOT 3
- README OATH screenshot needs refresh HOT 1
- Unable to use a custom domain to log in HOT 1
- Remove cancel button login HOT 5
- Support for <upsert>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftlysalesforce.