• Superdome
  • NEWBIE
  • 5 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies

Is there any system method can count the total number of records of the specific object ? (for example: schema.*).

 

Or, how to do it with salesforce apex code to count the number of records in which the object(table) size is over 50,000 ?

 

Integer count = [ SELECT count() FROM Object__c ];

Use count() in the way will return error: Too many query rows: 50001

 

-----------------------------

 

Have done some research and there seems no way to do it easily... :-(

Like to do a update with more than 2,000,000 records in the developer console.
 
Is the pattern workable to do the task ?
 
Boolean onOff = true;
while(onOff){
    onOff = asyncApex.doUpdate();
}
 
----------
global class asyncApex {
 
  @future 
  public static Boolean doUpdate() {
       List<Object> recs = [ select id,  name from Object LIMIT 10000];
       List<Object> rUpdate = new List<Object>();
       for(Object o: recs){
            Object t = new Object();
            ....
            rUpdate.add(t);
        }
        update rUpdate;
        if(recs.size()==0) return false; else return true;
  }
}

While user clicks the button just while the custom page is loading, it will make the mistake.

 

How to disable the button until the page is fully loaded?

 

Have tried and searched, it seems to use $(Document).ready with visualforce or <BODY onLoad=...> javascript.

 

Is it the solution to prevent from the problem ?

 

Try the codes.

 

With value=.... in the apex:inputCheckbox, all of the commandLink and commandButton doesn't work.

 

Even the commandButton in the case, it is not related to the inputCheckbox at all. But it is just unable to open the pageReference url as it should be.

 

Without value=.... the commandLink and commandButton just works fine.

 

Is it bug ?

 

VF:

 

<apex:page controller="SelectRadio" sidebar="false">
    <apex:outputPanel id="outputPanel">
    <apex:form >
        <apex:dataTable border="4" value="{!ords}" var="o">
            <apex:column >
                <apex:commandLink action="{!SelectTicket}" reRender="outputPanel">
                    <apex:inputCheckbox value="{!ordsOptions[o]}"/>
                    <apex:param name="selected" value="{!o.id}" assignTo="{!selected}"/>
                </apex:commandLink>
            </apex:column>
            <apex:column value="{!o.Id}"/>
            <apex:column value="{!o.Name}"/>
        </apex:dataTable>
        <apex:commandButton action="{!rSfdc}" value="按鍵"/>
    </apex:form>
    <hr/>
    <h1>Debug</h1>
        <p>ordsOptions = {!ordsOptions}</p>
        <p>ordsOptionName = {!ordsOptionName}</p>
        <p>selected = {!selected}</p>
    </apex:outputPanel>
</apex:page>

 Class:

public with sharing class SelectRadio {

    public List<String> vars {get;set;}
    public List<Custom_Object__c> ords {get; set;}
    public Map<Id,Boolean> ordsOptions {get; set;}
    public Map<Id,String> ordsOptionName {get; set;}
    public Id selected {get;set;}
    
    public SelectRadio(){
        ordsOptions = new Map<Id,Boolean>();
        ordsOptionName = new Map<Id,String>();
        ords = [ SELECT Id, Name FROM Custom_Object__c ORDER BY Name ];
        for (Custom_Object__c tmp : ords) {
            ordsOptions.put(tmp.Id, false);
            ordsOptionName.put(tmp.Id, tmp.Name);
        }
    }

    public pageReference SelectTicket() {
        return null;
    }

    public PageReference rSfdc() {
        PageReference rp = new PageReference('http://www.salesforce.com');
        rp.setRedirect(true);
        return rp;
    }
}

 

Pure styled CSS is an open and free styled CSS, and it provides a very wonderful skin builder.

 

Really like it, and share with everyone.

 

<apex:page standardStylesheets="false" showHeader="false">
    <apex:styleSheet value="http://yui.yahooapis.com/pure/0.1.0/pure-min.css"/>
    <div id="yui_3_9_1_1_1370668995942_3017" class="widget-preview-label">Using Pure Styled CSS</div>
        <form class="pure-form">
        <fieldset>
            <legend>Legend</legend>
            <input placeholder="Email" type="text"/>
            <input placeholder="Password" type="password"/>
            <label>
            <input type="checkbox"/> Opt in
            </label>
            <button class="pure-button" type="submit">Sign in</button>
        </fieldset>
    </form>

    <div>Default Form</div>
        <form>
        <fieldset>
            <legend>Legend</legend>
            <input placeholder="Email" type="text"/>
            <input placeholder="Password" type="password"/>
            <label>
            <input type="checkbox"/> Opt in
            </label>
            <button type="submit">Sign in</button>
        </fieldset>
    </form>
</apex:page>

 The screenshot:

 

(.... Find no way to insert image here ...)

Just copy & paste the code of the visualforce to an new apex page, and you can find the screenshot.

 

Ref: http://purecss.io/

 

 

Apex Editor LS is a free alterantive to the Force.com IDE apex editor.

New features in version 1.1:

 

- Mark occurrences feature - highlight all occurrences of a symbol

- Show dialog to associate .cls and .trigger files with Apex Editor LS
- Improved speed and removed locks of pre-parser. Faster startup
- Added hover for error markers in editor
- Fixed NPE when viewing a file from history or version repository
- When typing semicolon and open brace, they will be placed after current statement
- Fixed CME when doing rapid undos
- Improved content assist

 

Check out all the features at http://multimodus.hr/apex-editor-ls.html

While user clicks the button just while the custom page is loading, it will make the mistake.

 

How to disable the button until the page is fully loaded?

 

Have tried and searched, it seems to use $(Document).ready with visualforce or <BODY onLoad=...> javascript.

 

Is it the solution to prevent from the problem ?

 

Try the codes.

 

With value=.... in the apex:inputCheckbox, all of the commandLink and commandButton doesn't work.

 

Even the commandButton in the case, it is not related to the inputCheckbox at all. But it is just unable to open the pageReference url as it should be.

 

Without value=.... the commandLink and commandButton just works fine.

 

Is it bug ?

 

VF:

 

<apex:page controller="SelectRadio" sidebar="false">
    <apex:outputPanel id="outputPanel">
    <apex:form >
        <apex:dataTable border="4" value="{!ords}" var="o">
            <apex:column >
                <apex:commandLink action="{!SelectTicket}" reRender="outputPanel">
                    <apex:inputCheckbox value="{!ordsOptions[o]}"/>
                    <apex:param name="selected" value="{!o.id}" assignTo="{!selected}"/>
                </apex:commandLink>
            </apex:column>
            <apex:column value="{!o.Id}"/>
            <apex:column value="{!o.Name}"/>
        </apex:dataTable>
        <apex:commandButton action="{!rSfdc}" value="按鍵"/>
    </apex:form>
    <hr/>
    <h1>Debug</h1>
        <p>ordsOptions = {!ordsOptions}</p>
        <p>ordsOptionName = {!ordsOptionName}</p>
        <p>selected = {!selected}</p>
    </apex:outputPanel>
</apex:page>

 Class:

public with sharing class SelectRadio {

    public List<String> vars {get;set;}
    public List<Custom_Object__c> ords {get; set;}
    public Map<Id,Boolean> ordsOptions {get; set;}
    public Map<Id,String> ordsOptionName {get; set;}
    public Id selected {get;set;}
    
    public SelectRadio(){
        ordsOptions = new Map<Id,Boolean>();
        ordsOptionName = new Map<Id,String>();
        ords = [ SELECT Id, Name FROM Custom_Object__c ORDER BY Name ];
        for (Custom_Object__c tmp : ords) {
            ordsOptions.put(tmp.Id, false);
            ordsOptionName.put(tmp.Id, tmp.Name);
        }
    }

    public pageReference SelectTicket() {
        return null;
    }

    public PageReference rSfdc() {
        PageReference rp = new PageReference('http://www.salesforce.com');
        rp.setRedirect(true);
        return rp;
    }
}

 

Apex Editor LS is an alternative eclipse editor plugin for the SalesForce.com Apex language.

 

Latest new feature: Objects and object fields support in content assist.

 

Visit plugin home page for full info.

  • February 27, 2012
  • Like
  • 0