+ Start a Discussion
kdmrkdmr 

Semi Joing SOQL queries in API version 15

Hi I am trying to use semi joins in a select statement but am not able to excute it, when i try the same in Apex Explorer it returns a message that semi joins are not supported in this method. Could some one tell me if I could use semi join in API version 15.0? 

Coming to the problem I have a custom object with a lookup relationship with the Product object. I have created a visual force page for new and edit of the custom object. What I would like to do is on clicking save, I want it to redirect to the Product details page for the product selected in the lookup. I am stuck in my controller class where I am not sure how to write the page reference to this. Any help would be great.

 

Thanks

KD

 

Could also tell how to truncate the 18 digit Id to a 15 digit one in Apex. 

 

Message Edited by kdmr on 05-21-2009 04:38 AM
Best Answer chosen by Admin (Salesforce Developers) 
XXXXXX

Sure you can -- but first you have to update Apex Explorer to API version 15. To do this, go to File|Options, and change the number at the end of the Endpoint field to 15.0. (Mine was set to 8.0, I think this is what Apex Explorer ships with.) Log out, log back in, and your semi-join should work.

 

John

 

All Answers

Anup JadhavAnup Jadhav

Hi KD,

 

When the product is selected in the lookup, grab the product name( assuming all of the products have unique name), then write a soql query to retrieve the product id using the product name.

 

Using the id, you can create a url = http://<your_instance>.salesforce.com/<product_id>.

 

 

-'Could also tell how to truncate the 18 digit Id to a 15 digit one in Apex'

 

what do you mean by 'truncate' here? do you want the most significant bits removed or the least significant bits removed?

 

Also, if you use the 18 digit id in the url, it will display the correct object.

 

- Anup

 

 

XXXXXX

Sure you can -- but first you have to update Apex Explorer to API version 15. To do this, go to File|Options, and change the number at the end of the Endpoint field to 15.0. (Mine was set to 8.0, I think this is what Apex Explorer ships with.) Log out, log back in, and your semi-join should work.

 

John

 

This was selected as the best answer
MystiMysti

Hi!

 

To answer your question about 18-char vs. 15-char, here's the info rom the API developer's guide:

 

Because there are applications like Access which do not recognize that 50130000000014c is a different ID from 50130000000014C, an 18-digit, case-safe version of the ID is returned by all API calls. The 18 character IDs have been formed by adding a suffix to each ID in the Force.com API. 18-character IDs can be safely compared for uniqueness by case-insensitive applications, and can be used in all API calls when creating, editing, or deleting data.

 

If you need to convert the 18-character ID to a 15-character version, truncate the last three characters. Salesforce.com recommends that you use the 18-character ID.

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/field_types.htm