close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist sort

Thread began 11/19/2009 1:15 pm by chris373619 | Last modified 11/20/2009 12:53 pm by Jason Byrnes | 2866 views | 8 replies |

chris373619

DataAssist sort

Hi,
I have a database and I need help on sorting. How do I sort something for the exact file name with the extension of the file. I just want the record to show if the file name is exact. But all the files have ".pdf" at the end. How do I get the sort to not look at the file extension.

Sign in to reply to this post

neilo

You should be able to do this by double clicking the relevant Recordset in your bindings panel, and in the recordset (advanced, not simple) window that opens, select the relevant table from the 'Database items' section

Expand 'tables', select and expand the appropriate table, highlight the (Filename?) column you want to sort by and click the 'Order By' button.

Check the last line in the SQL window (scroll down to the bottom) to make sure you only have the 'ORDER by' code that you want. (It's easy to forget to remove a previous Order by).

Edit: Or just change the 'ORDER by' bit in the page php.

Sign in to reply to this post

neilo

Best see this thread:

showthread.php?t=7555

Sign in to reply to this post

chris373619

How does this get ride of the extension (.pdf) in the file name as a part of search criteria? In my database the file names are "filename.pdf". I only want the first bit of that to be the search criteria and to only show a record if the whole first part is equal to the record without the pdf.

I hope I explained that right. I did look at the link you posted but I didn't see how I could apply that to my situation.

Sign in to reply to this post

Jason ByrnesWebAssist

Chris,

I think there is a little confusion here, the question you *asked was how to sort the recordset, the file extesnion wont effect recordset sorting. Sorting is the order in which the results are returned.


It looks like what you are really looking for is how to Search the database which is completely different kettle of fish.

since all of your files have the extesnion ".pdf" the simplest solution will be to append .pdf to the search string.

another way to go about it will be to use the replace function in your recordset:
SELECT REPLACE(filenameColumn, ".pdf", "") as stripedFileName FROM tblName

Get your search page to a point where it is working when you include the file extesnion in the search criteria, then post a copy of the page here, and I will let you know the modification to make so that it will work without the file extesnion in the search criteria.

Sign in to reply to this post

chris373619

Sorry for the sort confusion.
I think this is good. I have it set to "begins with" but I wanted it to be = (without the .pdf).
Thanks for you help!

Attached Files
index.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

Try changing line 50:

php:
$WADbSearch1->addComparisonFromEdit("filename","S_filename","AND","Begins With",0);




to:

php:
$WADbSearch1->addComparisonFromEdit("REPLACE(filename, \".pdf\", \"\")","S_filename","AND","=",0);
Sign in to reply to this post

chris373619

Works perfectly.

When I open DataAssit search Server Behavior it says the the code was hand coded. If I need to change something I would just need to fix this line after?

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, That is correct.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...