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!
|
|
ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 24 Jun 06 10:58 AM
|
abortion pill abortion pill online usa fiogf49gjkf0d It seem that ASP.NET Boolean fields look for either 1/0 or true/false where SLX Boolean fields are T/F The best way I've found to handle this is to translate the SQL at source;
For example;
Select SQL = "Case ISEXTERNAL when 'T' then '1' ELSE '0' End as ISEXTERNAL" Insert SQL = "Case @ISEXTERNAL when '1' then 'T' ELSE 'F' End" Update SQL = "[ISEXTERNAL] =Case @ISEXTERNAL when '1' then 'T' ELSE 'F' End"
The other benefit of this method is that for UPDATES and INSERTS it eradicates NULL's
If any one knows a better way please let me know
-- Duncan |
|
|
|
Re: ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 24 Jun 06 7:28 PM
|
how much does the abortion pill cost without insurance abortion pill cost cvs fiogf49gjkf0d I usually do the boolean translation one of two ways. First way is how you mention (in the views/procs/queries). It does work well. However, I also do it in the business objects. I hardly ever work directly with data in my apps. I always wrap the calls for data access in a layer that will dish out business objects. I find that I often will wrap the translation got booleans in the properties for the fields in the objects. |
|
|
| |
|
Re: ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 27 Jun 06 12:09 PM
|
fiogf49gjkf0d Well, I can't think of any sources off top of my head. I have a tool that generates the base of the business objects from an entity in SLX. It is *very* crude, but maybe I could clean that up and put it on this site at some point. Basically you build a layer that will access the data and stuff it into nicely typed objects so you are using those instead of raw data. The objects are bindable to controls and it sure makes for nicer syntax.
I prefer something like this:
Account account = broker.GetAccount(accid); if (account.Type == AccountType.Customer) { account.Status = "Active"; if (account.IsTargetAccount) { account.History.Add(new History(HistoryType.PhoneCall, DateTime.Now.AddDays(5))); } foreach (Contact contact in account.Contacts) { if (contact.Email != string.Empty) { Mailer email = new Mailer(contact.Email); email.Subject = stdemailsubject; email.Body = stdemailbody; email.Send(); } } account.Save(); }
...over using clunky DataSets and DataReaders any day (and who wouldn't? ) |
|
|
|
Re: ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 27 Jun 06 4:37 PM
|
fiogf49gjkf0d Here's my conversion code for the SLX Boolean to bool:
public static bool ConvertBooleanStringToBool(string stringBoolean) { // F = false, T = true bool booleanReturn = false; switch(stringBoolean.ToUpper()) { case "F": booleanReturn = false; break; case "T": booleanReturn = true; break; } //MessageBox.Show("String: " + stringBoolean + "\nBoolean: " + booleanReturn); return booleanReturn; }
Just as there exists Common plugins that handle conversions in SalesLogix, this function would go into a common business object as it covers literally every table.
Regarding the tool, I'd love to contribute to making the code production quality (though I have no doubt it's useable as-is). I could even contribute my knowledge of Delphi to create objects for use there for those of us who value straight Win32 programming (Delphi 7 that is, haven't nor will I use Delphi.NET (version 8 burned me)). I'm currently in a project that relies heavily on DataSets/Readers so it would be nice to think in BOs instead of this hodge-podge of "get something out the door, yesterday". That'll have to be a couple of versions from now anyway but having something to help, plus the applied knowledge of someone like yourself who isn't head-down in Architect would make this so much easier. |
|
|
| |
|
Re: ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 27 Jun 06 4:46 PM
|
fiogf49gjkf0d My boolean properties are a bit simpler. You can expect that a SLX Boolean will be one of only 3 possible values: "T", "F", or NULL.
My properties look more like this:
private string _someboolfield; public string SomeBoolField { set { _someboolfield = value; } get { return _someboolfield.Equals("T"); } }
All you really care about is that the the value is "T", otherwise you assume false. As you can see from that code sample, I usually just store the true value inside the object and just translate it on reads of the property. |
|
|
|
Re: ASP.NET Boolean doesn't work with SLX Boolean Fields
Posted: 27 Jun 06 5:29 PM
|
fiogf49gjkf0d You are correct about assuming "T". SalesLogix does this as it sometimes leaves a boolean as NULL unless you specifically alter the control's properties. I convert to a bool because I use DataSets and it's much easier to deal with a bool than that one character string, plus I like the compactness of "if (blah)" instead of "if (blah.Equals("T"))". Largely personal preference as the conversion takes up unnecessary cycles in most instances. |
|
|
| |
| |
| |
|