calculated-columns

SQL Server 2005 Computed Column Result From Aggregate Of Another Table Field's Value

Sorry for the long question title. I guess I'm on to a loser on this one but on the off chance. Is it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a field in another table. i.e. You have a table called 'mug', this has a child called 'color' (which makes my UK head hu...

How can I cache a calculated column in rails?

I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many :sub_parts, :class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation } else sleep(1) return rand(10000) e...

MS Access Math

Hi, I've got a table in MS Access 2007 with 4 fields. Labour Cost Labour Hours Vat Total How do I multiply 'Labour Hours' by 'Labour Cost' add the 'VAT' and display the answer in 'Total' Where would I put any formulas?, in a form or query or table ? Many thanks for any help Scott ...

SQL Server: preserve calculated fields with a SELECT INTO

Hello, My company performed a data migration recently (in a SQL Server 2005 database) and we noticed that some tables created with SELECT INTO didn't maintained the calculated fields of the original tables, but instead SQL Server created regular fields with the type returned by the original calculation. For example, suppose that you hav...

Hiding Columns

Hi, I am looking at a macro which would hide columns for a particular range every time i run the query. For Ex: For the first time when i run the query, I would need Columns A to D to be hidden, like wise the next time i run the query, I would need columns E to H to be hidden. Its basically a query that would generalize the column hid...

Sorting based on calculation with nhibernate - best practice

I need to do paging with the sort order based on a calculation. The calculation is similar to something like reddit's hotness algorithm in that its dependant on time - time since post creation. I'm wondering what the best practice for this would be. Whether to have this sort as a SQL function, or to run an update once an hour to calcula...

MySql moving differences?

Suppose I have this code create temporary table somedata (a integer); insert into somedata (a) values (11), (25), (62); --#these values are always increasing select * from somedata; giving this +--+ |a | +--+ |11| |25| |62| +--+ How do I calculate a column of values 'b' where each one is the difference between the value of 'a' in t...

Sharepoint: Calculated Column replace all spaces

Seems like it would be a simple thing really (and it may be), but I'm trying to take the string data of a column and then through a calculated column, replace all the spaces with %20's so that the HTML link in the workflow produced email will actually not break off at the first space. For example, we have this in our source column: fil...

Calculated Column Formula

Goal: Translating the functionality of a formula that works in Excel, into something I can use in a calculated column in SharePoint. Alternate Goal: A completely different solution from the one I'm currently trying to make work. Scenario: Running MOSS 2007, I have a list with a text column populated with multiple dates (in text forma...

SQL/.NET TableAdapters - How do I strongly-type calculated columns in either the database or the DataSet?

We use calculated columns in a few SQL Server 2005 tables which always return data of a specific type (bit, varchar(50), etc...). These tables are consumed by a .NET data layer using strongly-typed datasets and tableadapters, however since the calculated columns are not constrained to a specific type (we always return a specific type, b...

Sharepoint Calculated column formula for date-time comparison

Hi, I have two columns C1 and C2, both of type date and time in a document library. Now i want to create a calculated column C3 using which i could know which column(C1 or C2) is having greater value. I tried following formula for calculated column IF(C1>C2, 1,0) it works perfectly fine, but if i replace C1 with 'Modified' column it doe...

MySQL: Calculated Column Based on Two Calculated Columns

I'm trying to do a rather complicated SELECT computation that I will generalize: Main query is a wildcard select for a table One subquery does a COUNT() of all items based on a condition (this works fine) Another subquery does a SUM() of numbers in a column based on another condition. This also works correctly, except when no records m...

SharePoint: Calculated Column Values Disappear When Editing List Item. Any ideas?

I have a calculated column in a custom SharePoint 2007 list, with the following formula: =CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25)) If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item. So, on creation: "IR-40-TheTitleIsHe...

MySQL: Sum Subqueried Columns

Is there an elegant way to do this in MySQL: SELECT (subquery1) AS s1, (subquery2) AS s2, (s1+s2) AS s3 or must I resort to SELECT (subquery1) AS s1, (subquery2) AS s2, ((subquery1)+(subquery2)) AS s3 ? Thanks EDIT: both subqueries yield integer results ...

Getting started developing for SharePoint

This is in response to the answer given for the case: http://stackoverflow.com/questions/702556/sharepoint-calculated-column-replace-all-spaces I'm having the exact issue that the original poster has and I'm fairly new at doing development with SharePoint meaning I have yet to venture into doing coding. Can someone point me to a link o...

Horizontal and Vertical complicated Javascript Calculation and Coldfusion

Now the table is being populated with 2 loops and an array. I have to control everything through the classes I put on the input. Been working on this for a while, some insight would be helpful. Here is the loop and the inputs: <cfloop from="1" to="#ArrayLen(labels)#" index="r"> <tr> <td class="labels"><cfif ArrayIsDefined(...

SELECT with calculated column that is dependent upon a correlation

I don't do a lot of SQL,and most of the time, I'm doing CRUD operations. Occasionally I'll get something a bit more complicated. So, this question may be a newbie question, but I'm ready. I've just been trying to figure this out for hours, and it's been no use. So, Imagine the following table structure: > | ID | Col1 | Col2 | Col3 |...

How to determine the number visible children in an hierarchical report?

I am using SQL Server Reporting Services 2008 to create a report. A table in this report displays hierarchical data, using a ID and ParentID field in the data. Each data row has an ID field and a ParentID field, where the ParentID points to the ID of the row that is its parent. Displaying this hierarchically is no problem, but now I wa...

Calculated Column formula

Hello All, I have this question regarding creating a calculated column in SharePoint. My problem is that I need a column that will display text values in a dropdown list and once the user selects one of the text values, a number value will be assigned to each text value and will be stored in the field to be referenced by another calcula...

xcode core data: how do I get "computed" attributes?

Hello, I have a entity in my core datamodell, "Tours". Tours has a attribute called "creationDate". In my iphone up, I want the tours to be seen in an table view, ordered by creationDate. This works fine. But now I want to go into master/detail. That is, I want to see in the master table view all Year/Month combinations from my tours en...