On Wed, Dec 9, 2009 at 4:49 AM, Jonathan Kaye <[email protected]> wrote:
> This is a simple question but hours of searching various documents hasn't > turned up an answer yet. In a spreadsheet I can assign a function whose > argument is a cell to perform an operation that is displayed in the cell > containing the function call. Thus, if cell B1 has the formula =upper(A1) > and A1 has a string "Hello world", then B1 will display "HELLO WORLD". I > can > also use a macro in a similar fashion to map one string of characters onto > another. > > My question is: how do I do this in a database? I would like to define a > field in a query whose value is calculated by applying my macro to the > value > of another field. I have a field called "ENTRY" in my database and I would > like to create another field whose value is FIXSORT(ENTRY) where FIXSORT is > a macro that I've written which maps one string onto another one. I assume > this is done using a query but I've been unable to figure out how to create > the calculated field. > > Thanks for any help. > Jonathan > -- > Registerd Linux user #445917 at http://counter.li.org/ > Please do not send me copies of list mail. I read the lists. Thanks! > > I doubt that you can do it with an OOo macro (others may know more). However, you can probably do what you want with SQL, depending on the DBMS you are using and the actual substitution you would like to make. In your example, you can formulate an SQL query using the UPPER function to display Hello World as HELLO WORLD. For a more complex query, you might want to consider using the stored procedure or function capabilities of you DBMS. John
