Category Archives: soql

SQLForce – ANSI SQL for SalesForce

There are great tools for SalesForce that we don’t hear much about:

SQLForce – Command line interpreter with ANSI SELECT/DELETE/MODIFY//INSERT commands that work with Salesforce.

http://code.google.com/p/sqlforce/

Advertisements

My 1st little App Exchange: SOQL Query Tool

As a little exercise, I’ve created a small tool comprised of a VisualForce page/tab that allows system administrators to run ad-hoc SOQL (SOSL and aggregate queries) from within their applications and do mass update on every page of 100 records. Basically, it reproduces a little of the functionality of the DeveloperForce utility Mass Update Anything.

This tool is available at the AppExchange for free:   goo.gl/90V8f

(The listing is private because SalesForce seems to only allow SalesForce Pardners – that is, companies – to take their apps to security review and make them public.)

SOQL Query Tool screenshot

The results of an ad-hoc query executed in SOQL Query Tool (click to expand).

In one class I used ApexPages.StandardSetController with a Database.QueryLocator to implement pagination of the query results.

objStdSetCtrl = new ApexPages.StandardSetController( Database.getQueryLocator( SOQLText ) );

In the VisualForce page I used the tag apex:repeat to display a dynamic list of columns nested in an apex:pageBlockTable that iterates on the query results’ rows.

<apex:pageBlockTable id="ResultsTbl" value="{!QryResults}" var="row">
    <apex:repeat id="ColumnsRpt" value="{!LstColNames}" var="col">
         <apex:column >
                {!col}
                <apex:outputLink rendered="{!( col == 'Id' || col == 'Name' )}" value="/{!row.id}" target="new">
 <apex:outputText value="{!row[col]}" />
...