Print Thread
Override or Force TrimStringField Option
#48721 03/06/14 08:19 AM
Joined: Feb 2014
Posts: 3
A
Member
OP Offline
Member
A
Joined: Feb 2014
Posts: 3
Hello,

Is there any way to turn off / override TOracleSession.Preferences.TrimStringFields for a specific DataSet or Query while it is set at the session? Or a different method of making a query so that I get the "actual" field content back and not the trimmed version? (without having to change the session obviously)

Also as the trimming only seems to apply to reading and not writing, is there an option for making it trim text that is written to the database (aside from doing that manually with events etc)?

---

To give you a real world example of my problem...

Say I have two records (in separate tables) related to a TV Programme. One for the Programme and one for the Series it is part of. The Series record has a TITLE field and the programme record has a TITLE and a SUB_TITLE field. where the SUB_TITLE field is used when the programme TITLE is the same as the series TITLE.

Example:
Series TITLE = 'Doctor Who'
Programme TITLE = 'Doctor Who'
Programme SUB_TITLE = 'Episode 42'
So for Series Title + Programme Title you'd get 'Doctor Who - Episode 42'.

Now say I have an DBEdit box for the Programme Title showing the current field content from the record as 'Doctor Who' and a user adds a space and tries to save it. This DOESN'T work as it seems to compare the equivalent of Trim('Doctor Who') with Trim('Doctor Who '), thinks there's no change and so leaves the record as is.

BUT, if the user changed the title to 'Doctor Who 2014', saved it, realised that was daft and then changed it to 'Doctor Who ' and saved it, then that WOULD work as Trim('Doctor Who 2014') with Trim('Doctor Who ') are different. However it writes the UNTRIMMED text to the record.

Now I have the situation where in the record there is a space but in my application DBEdit box you can't see it, and can't remove it.

So now in the example I have:
Series TITLE = 'Doctor Who'
Programme TITLE = 'Doctor Who '
Programme SUB_TITLE = 'Episode 42'
So for Series Title + Programme Title you'd now get 'Doctor Who - Doctor Who '.

I know that I could do Trims when comparing the TITLE's to determine the use of SUB_TITLE, but it's a pain to have to do this in every case whilst not being able to see and remove spaces in DBEdits.

Hope that made sense :o)

Cheers....

PS - Yes I know this is a follow up to an earlier post, but new posts seem less likely to be overlooked :o)

Re: Override or Force TrimStringField Option
AndrewKindred #48722 03/06/14 10:51 AM
Joined: Aug 1999
Posts: 22,173
Member
Offline
Member
Joined: Aug 1999
Posts: 22,173
The TOracleQuery component will never automatically trim the field contents, it will always retrieve exactly what is in the database. It cannot be used with data-aware components like the TOracleDataSet though, so it is of limited use.

There is no option to control TrimStringFields behavior at the dataset level. You can only do so at the TOracleSession level.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.021s Queries: 15 (0.006s) Memory: 2.5017 MB (Peak: 3.0397 MB) Data Comp: Off Server Time: 2024-03-29 08:53:53 UTC
Valid HTML 5 and Valid CSS