इस तरह नक्शा बनाएं:
Map<String, Schema.SObjectField> fldObjMap = schema.SObjectType.Account.fields.getMap();
List<Schema.SObjectField> fldObjMapValues = fldObjMap.values();
तो फिर तुम एक SOQL क्वेरी स्ट्रिंग बनाने के लिए fldObjMapValues के माध्यम से पुनरावृति कर सकते हैं:
String theQuery = 'SELECT ';
for(Schema.SObjectField s : fldObjMapValues)
{
String theLabel = s.getDescribe().getLabel(); // Perhaps store this in another map
String theName = s.getDescribe().getName();
String theType = s.getDescribe().getType(); // Perhaps store this in another map
// Continue building your dynamic query string
theQuery += theName + ',';
}
// Trim last comma
theQuery = theQuery.subString(0, theQuery.length() - 1);
// Finalize query string
theQuery += ' FROM Account WHERE ... AND ... LIMIT ...';
// Make your dynamic call
Account[] accounts = Database.query(theQuery);
superfell सही है, कोई रास्ता नहीं सीधे एक का चयन करने के लिए है *। हालांकि, यह छोटा कोड नुस्खा काम करेगा (ठीक है, मैंने इसका परीक्षण नहीं किया है, लेकिन मुझे लगता है कि यह ठीक दिखता है)। समझा जा सकता है कि Force.com एक बहु-किरायेदार वास्तुकला चाहता है जहां संसाधनों को केवल स्पष्ट रूप से आवश्यक रूप से प्रावधान किया जाता है - आसानी से चयन करके * आसानी से जब फ़ील्ड का केवल एक उप-समूह वास्तव में आवश्यक होता है।
धन्यवाद। क्या आप वर्णन उदाहरण से क्वेरी बनाने के लिए एक उदाहरण साझा करना चाहते हैं। – Sukhhhh