Git Product home page Git Product logo

Comments (26)

perbrondum avatar perbrondum commented on September 25, 2024 1

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024 1

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@perbrondum would you post your (formatted) code, please?

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024
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.

perbrondum avatar perbrondum commented on September 25, 2024

You get the error when you add the GROUP clause. The count is not really relevant.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024

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.

mike4aday avatar mike4aday commented on September 25, 2024

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.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024

Is branch V9-fix-135 the fix for the bug?

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@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.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024

Thanks a lot for fixing this. Looks like I was able to pass all our tests with this fix.

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@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.

perbrondum avatar perbrondum commented on September 25, 2024

Have you decided on a V9 or V10 release for the fix?

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@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.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024

Mike - Are you still considering a 9 release for this fix or is it pushed to R10? Thanks.

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@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.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@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.

mike4aday avatar mike4aday commented on September 25, 2024

Thanks @perbrondum - it's good for me to know what's useful.

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

Fixed in version 10.0.0

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

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.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

mike4aday avatar mike4aday commented on September 25, 2024

@perbrondum re. the issues you mentioned:

  1. Is TASK a custom object that you created to represent the Salesforce Task sObject?
  2. 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.
  3. I will fix that asap -- please see issue #144 for a workaround in the meantime
    Thank you for the feedback.

from swiftlysalesforce.

perbrondum avatar perbrondum commented on September 25, 2024

from swiftlysalesforce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.