Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 External Development Forums - General External Development
Forum to discuss general external development topic (related or not to SalesLogix development). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to General External Development | New ThreadView:  Search:  
 Author  Thread: Remove the cap on SalesLogix ID's limits create your own custom ID generator
John Padilla
Posts: 7
 
Remove the cap on SalesLogix ID's limits create your own custom ID generatorYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Jan 08 4:49 PM
I have found that installing the SLX services on certain servers to be a limitation to coding external SalesLogix applications. As a first level stepping stone I have decided to post my class that increments the 7 character portion of any SalesLogix id (Base 36) by one.

Looking at this article: http://slxdeveloper.org/page.aspx?id=35&articleid=87 gave me a head start.

To break away from using the API for apps that did not require their data changes into the SalesLogix db synchronized out to remotes, or to remove the id cap that the current SalesLogix id generator had, I created my own SalesLogix ID generator. Attached is the starter class that shows how to start with 7 char/digit value and increment them by 1. I can't take the credit for the code. I pulled this down from a response to a base 36 question by Tony Tortora on the "IT Developer The Scripts Forum":

http://www.thescripts.com/forum/thread236928.html

You can use the information in Ryan's article to extend the SlxIDFactory class to accept an additional value such as a Slx Object Type (i.e. literature request or history) and make this a full fledged Id generator.

Having this ability allows you to:
- create mobile SalesLogix based applications;
- use native SQL provider when the data being created does not require synchronization to remote users.
- avoid having to install SalesLogix services on production/remote servers
- extend the number of possible SalesLogix id's beyond the 1.6 billion limit for the last 7 digits: to do so you would simply change the MBase36 initial value (code is down below at the bottom of this article).

Examples of extending:
If you wanted to also include lowercase letters this would be the new value to use:
string MBase36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
so if the XXXXXA00001Z is the current id, the next id would be XXXXXA00001a

you could also include high ascii characters:
string MBase36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*():>so if the XXXXXA00001Z is the current id, the next id would be XXXXXA00001~

These would be equally valid and would work in SalesLogix. Note: be aware of using certain high ascii values such as " or ' or , as these can cause problems when using them in search strings or certain programming situations.

Having the ability to raise the limit of the SalesLogix unique base36 value can be a benefit in ecommerce apps where there are a high volume of responses and these need to recorded into SalesLogix db for reporting (i.e. web based literature request and user registration).

this is the class that generates an incremented value:
using System;
using System.Collections.Generic;
using System.Text;

namespace SlxIDUtils
{
public static class SlxIDFactory
{
//sample value: A00001Z - 7 character limit
public static string GetIDValue(string MNumber)
{
bool MAddOne;
string MNewKey;
int MCounter;
int MIndex;

string MResult;
string MBase36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//string MBase36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

MResult = "";
MNewKey = "";
MAddOne = true;

for (MCounter = MNumber.Length - 1; MCounter >= 0; MCounter--)
{
MIndex = MBase36.IndexOf(MNumber[MCounter]);

if (MAddOne)
{
if (MIndex == MBase36.Length - 1)
{
MIndex = 0;
MAddOne = true;
}
else
{
MIndex++;
MAddOne = false;
}
}

MNewKey = MNewKey + MBase36[MIndex];

}


for (MCounter = MNewKey.Length - 1; MCounter >= 0; MCounter--)
{
MResult = MResult + MNewKey[MCounter];
}

return MResult;

}
}
}

Hope this is helpful!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 2:30:32 PM