function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LukeLuke 

Updating contacts

Hmmm... seems like I have a slight problem with updates.  I always get Malformed Query

Here is what i pass:

qr = binding.query("select Name, numberOfEmployees, Id, MEMBER_ID__c Industry from Contacts where MEMBER_ID__c=" & MEMBER_IDStr)

MEMBER_ID is a numeric(9,0) field.

and if I do it this way:

qr = binding.query("select Name, numberOfEmployees, Id, MEMBER_ID Industry from Contacts where MEMBER_ID=" & MEMBER_IDStr)

It also fails.

Member_ID is always unique number, so there won't be two records with the same member_id.

Thanks. Lukasz

DevAngelDevAngel

Hi Luke,

Common error.  I think you want from Contact instead of from Contacts (no s after Contact).

Cheers.

LukeLuke

That doesn't seem the problem... Yes, true I forgot the s but even changing it doesn't improve anything.

qr = binding.query("select MEMBER_ID__c from Contact where MEMBER_ID__c=" & MEMBER_IDStr)

The above query produces an error of malformed query.  I'm using API 2.5.

How should I handle custom fields in this case?  I tried different methods and all of them fail.

LukeLuke

Is anyone responding to questions on forums?

L

DevAngelDevAngel

Hi Luke,

Can you try making the MEMBER_IDstr variable a double and see if that works?

LukeLuke
Double doesn't work, I still get the same error message.  I tried passing it as string as well, and it won't work.
DevAngelDevAngel

Hi Luke,

Can you construct the query as a string then print the string out in the debug window and post that to the boards?

Dim soql as String

soql = "select Name, numberOfEmployees, Id, MEMBER_ID__c Industry from Contacts where MEMBER_ID__c=" & MEMBER_IDStr

'I need to see the results of this trace statement

System.Diagnostics.Trace.WriteLine(soql)

 

LukeLuke

Here is the query that is passed (from the debug window like you wanted).

select Name, numberOfEmployees, Id, MEMBER_ID__c from Contact where MEMBER_ID__c=7002470

and I also get the following message:

INVALID_TYPE: value of filter criterion for field 'member_id__c' at (1, 69) must be of type double

LukeLuke

I also tried the following query:

select Name, numberOfEmployees, Id, MEMBER_ID__c from Contact where MEMBER_ID__c=7002470.0

and exactly the same problem.

What is the maximum length of the number field on sforce?

DevAngelDevAngel

Hi Luke,

All custom fields in sforce end up as doubles.  This means that for you ID you will need to append .0 to the value.  The actual value can be held in a string variable since we are creating a string any way.  Let me try creating a custom field of the same precision and scale as yours and I will report any findings.

Cheers

DevAngelDevAngel

Geez Luke,

I can't duplicate this.

Here is the query I ran:

sforceE.QueryResult qr = binding.query("Select Id, FirstName, LastName, NumberTest__c From Contact Where NumberTest__c = 123456789.0");

NumberTest__c is 9, 0

The only other thing we can do is look at the SOAP message you are generating.  Would you mind posting that here (remove the session id)?

Message Edited by DevAngel on 02-24-2004 03:41 PM

LukeLuke

Hi,

That's what I did.  For some reason VB was passing it wrongly.  Don't know why.  Debug window would show value as a double.  I just ended up converting MEMBERIDStr to string and appending .0 to the end.  This proved to work.

L

DevAngelDevAngel

Hi Luke,

Would you mind posting the snippet where you found the resolution?  I tend to do most of my testing in C# and I guess there are enough differences between the two that require precise enviroment simulation.

Cheers