You are not logged in.
Is there anyway to search on the text in the Location Description?
e.g.
WHERE LOCATION_DESCRIPTION LIKE 'Village'
This doesn't seem to work - presumably because it's a memo field?
Offline
SQL does allow 'Like' to be used on text fields so SELECT * FROM LOCATION WHERE LOCATION.DESCRIPTION LIKE('%Watsonian%') will work
Mike
Offline
Hmm, doesn't appear to be working for me.
Offline
Works fine for me, although for queries in the Access database you need to use the wildcard * instead of %.
However, in your example above Charlie you have LOCATION_DESCRIPTION, whereas the correct syntax is LOCATION.DESCRIPTION and because you are using no wildcard your query will only return locations where the description is Village (or village etc.) with no other text in the field.
Offline
Whoops, I meant Location.Description
We have quite a few locations with "Village" as the description that I wanted to pull out.
This is the SQL I'm using (which doesn't do what I expect):
SELECT LOCATION_KEY FROM LOCATION WHERE LOCATION.DESCRIPTION LIKE 'Village'
Whereas this does (and gives me more than I want):
SELECT LOCATION_KEY FROM LOCATION WHERE LOCATION.DESCRIPTION LIKE '%Village%'
But this does seem to work:
SELECT LOCATION_KEY FROM LOCATION WHERE LOCATION.DESCRIPTION LIKE 'Watsonian Vice-county'
I'm wondering if there are some RTF characters in their or something?
Offline
If all the litems you want only have 'Village' as the description, why not use
WHERE LOCATION.DESCRIPTION = 'Village'
Offline
Because
the data types text and varchar are incompatible in the equal to operator
Offline
Ah, that would make sense.
How about
WHERE LOCATION.DESCRIPTION LIKE 'Village%'
Which should only return those items where the description begins with Village.
Offline
Here's a suggestion, once you have a suitable selection, why not modify the location type term list to include an item called Village and set each of your locations' types to that value, then you should be able to filter them properly.
Offline
WHERE LOCATION.DESCRIPTION LIKE 'Village%'
Something even weirder happens... it only finds one location, but clicking on that location or using the go to addin with the location key brings up a blank location window ![]()
Last edited by charliebarnes (2010-07-29 16:35:40)
Offline
RobLarge wrote:
Here's a suggestion, once you have a suitable selection, why not modify the location type term list to include an item called Village and set each of your locations' types to that value, then you should be able to filter them properly.
Thats why I'm trying to filter them ![]()
Offline
select * from LOCATION where cast(DESCRIPTION as varchar(max)) = 'Village'
Offline
Ah that would do it
Offline
Its the RTF tags. This is what an export of one location description looks like:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\lang2057\f0\fs16 village\lang1033\f1
\par }Whereas Mikes suggestion of which uses Watsonian works because this is the location description:
Watsonian Vice-county
Removing the RTF tags from the decription field works. Thanks Matt!
Offline
Ah, those RTF codes are pain. For anyone reading this, just in case you haven't come across this before, there's a function built into NBNData that strips RTF tags and leaves just plain text. It's called ufn_RtfToPlaintext.
I wouldn't mind if RTF formatting was removed completely from comments boxes. Does anyone actually use or rely on the RTF features?
Offline
charlesr wrote:
I wouldn't mind if RTF formatting was removed completely from comments boxes.
Crossed my mind too.
Offline
One thing I have noticed with the RTF coding, is that if you copy some text from a document, which is in a 12 point font say, then paste into a recorder description field, the result is very large and if there's a lot of text, the result is a lot of scrolling needed to read it. I find I have to remember to convert any text into an 8 point in order to get a readable result on screen. It would be nice if this was possible within recorder, from the right-click menu, as are the bold & italic functions (which I must admit I use quite a lot in descriptive text).
So I agree that there is an issue with the rtf in description fields, but it is worth saying that in general terms it is not really good practise to be filtering on the contents of a free-text field, as it is too prone to errors. In most cases in Recorder I have found ways of using an existing field or co-opting one to suit my purposes.
Offline
RobLarge wrote:
In most cases in Recorder I have found ways of using an existing field or co-opting one to suit my purposes.
Hence me wanting to filter out on location description so I don't have to change each one individually ![]()
Perhaps an option to remove formatting within Recorder would be useful, or only use it when specifically requested (Recorder adds RTF even when no bold, italic etc is used)
Offline
Some people do take a lot of care to format the comment fields. It doesn't do any harm to remove the formatting from your own data or from system supplied data, but it isn't perhaps a good idea to remove it from imported data just in case it is ever passed on. In XML reports you can remove the RTF and CR/LF easily enough, although you do need to install the NBN Export addin in order to get the UDF to remove CR/LF. Having new fields in the report Wizard which removed the formatting would be very useful and easy to do so perhaps this could be considered for the next release.
Mike
Offline
MikeWeideli wrote:
but it isn't perhaps a good idea to remove it from imported data just in case it is ever passed on.
Wouldn't the rules of custiodianship come into force?
Offline
There is information on custody/ownership in the Recorder 6 Help – see Help – Contents tab – Tasks – Exchanging data – Transfer of ownership. More information can also be found using the Search tab to search for ‘Custodian’ and ‘Custody’.
If you develop batch updates to do things like remove RTF you need to remember that they do what you write them to do. They won’t automatically obey Recorder’s rules. You have to write them to obey the rules, so they are dangerous unless authors know the rules and incorporate them.
Offline