Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Gurus,
I have a requirement to query a Salesforce object and get a row count without actually retrieving all the rows. In SOQL I can execute the query: select COUNT() from Account
...and it will return the number of records. I can enter this same query into my tSalesforce component and it will execute without throwing an error.... so it doesn't seem to have a problem running the query itself. But I can't figure out how to access the value it returns.
Since it doesn't return with a field name, I can't specify the field in the Schema. I tried specifying a field to count... e.g.
Select COUNT(Id) from Account
And then creating a schema with a single line: Id --> Integer
No good. Id returns null.. I played around with using "COUNT" as the Column name, changing to a String, etc. Nothing works so far. I know that I can always select only the Id, let it fetch every row and then look at the tSalesforceInput_1_NB_LINE value for my row count. But I was trying to avoid the long run-time and the network traffic that occurs when retrieving every record. Any ideas what I might put in that schema?
Hello,
Please try the below query :
Select COUNT(Id) total from Account
in the schema of tSalesforceInput, setup the total as the column name as the below
Hello,
Please try the below query :
Select COUNT(Id) total from Account
in the schema of tSalesforceInput, setup the total as the column name as the below
Works great. Thank you!
I had tried using an alias in a SOQL query in the past and it failed. I discovered back then that Salesforce rejects aliases unless they are used on aggregate functions / "group by" SOQL queries. It must have slipped my mind.