- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
07-05-2012 07:19 AM
I have an odd problem with a SELECT string, trying to get data from Salesforce.
If I use "SELECT Unit_Price__c FROM Equipment_Data__c", it perfectly returns the Unit_Price__c
If I use "SELECT Deal_Type__c FROM Equipment_Data__c", it perfect returns the Deal_Type__c
But if I use "SELECT Unit_Price__c, Deal_Type__c FROM Equipment_Data__c", it only receives the Deal_Type__c correct, but return a "null" value for Unit_Price__c
Unit_Price__c is a "Number(16,2)" and Deal_Type__c is a Picklist (single).
What is wrong?
Any help really appreciated.
Solved! Go to Solution.
07-05-2012 06:54 PM
SELECT Unit_Price__c, Deal_Type__c FROM Equipment_Data__c
does have Deal_Type__c value
I mean some records may have Unit_Price__c only or both,
some records may have Deal_Type__c only or both,
and some records may have Unit_Price__c only, but not have Deal_Type__c
07-06-2012 01:38 AM
All records has both values. I tested the exact same SOQL SELECT in Force.com Explorer, and here it perfectly returns all the records and all of them have a value in both fields...?
07-09-2012 12:39 AM
Here you go: :)
Private Sub btnRtvOutlook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRtvOutlook.Click ' *** Delete all records in databse, which has been uploaded today Dim myConnection As New System.Data.SqlClient.SqlConnection(myConnString) Dim myQuery As String = "DELETE FROM tblXIST_ESR_OPP WHERE DATEDIFF(day, UPLOAD_TIME, GETDATE()) = 0" Dim myCommand As New System.Data.SqlClient.SqlCommand(myQuery, myConnection) myCommand.Connection = myConnection myCommand.Connection.Open() myCommand.ExecuteScalar() myCommand.Parameters.Clear() myCommand.Connection.Close() myConnection.Close() ' *** INSERT TODAYS OUTLOOK INFORMATION INTO THE DATABASE Dim qs As String 'This one works perfectly at returns the Unit_Revenue__c result being "26000" 'qs = "SELECT Id, Unit_Revenue__c FROM Equipment_Data__c" 'This one also works and returns the deal type perfectly being "Cash" 'qs = "SELECT Id, Deal_Type__c FROM Equipment_Data__c" 'This one also works, and return both field being "26000 - Cash" 'qs = "SELECT Id, Unit_Revenue__c, Deal_Type__c FROM Equipment_Data__c" 'This one doesn't work, it only returns "- - 14-06-2012 11:09:59" qs = "SELECT Id, Unit_Revenue__c, Deal_Type__c, CreatedDate FROM Equipment_Data__c" Dim qr As apex.QueryResult = binding.query(qs) If (qr.size = 0) Then Else For i As Integer = 1 To qr.records.GetUpperBound(0) Dim equipment As apex.Equipment_Data__c = CType(qr.records(i), apex.Equipment_Data__c) '*** HERE I NORMALLY HAVE A FUNCTION THAT RETURNS THE VALUES INTO A SQL DATABASE, BUT '*** I HAVE CUT IT OUT TO REDUCE PLACES OF ERRORS AND ARE ONLY RETURNING VALUES IN MSGBOX MsgBox(equipment.Unit_Revenue__c & " - " & equipment.Deal_Type__c & " - " & equipment.CreatedDate) Next End If End Sub