Showing posts with label depending. Show all posts
Showing posts with label depending. Show all posts

Monday, March 19, 2012

check fields in select statement

hi,

I am getting some fields back from a select statement, how do you check one of the fields and display a string depending on what it is? Is there something like an if statement you can use? for example

select

field1,
field2 /*how do you check to see what it is here and display something depending on what it is*/

from
record

I am trying to see if field2 is a '' or empty string character

thxYou use a CASE statement.


SELECT field1, CASE field2 WHEN '' THEN 'BLANK' ELSE field2 END as Field2 FROM Table

If rather than '' the value might be null, you can use ISNULL


SELECT field1, ISNULL(field2,'BLANK') as field2 FROM Table
|||thank you for the help

Sunday, February 19, 2012

Chart auto-resizing problem

Hi - does anyone know how to stop a chart auto-sizing? I need the chart to
stay the same size. At the moment, depending on what data is graphed, the
y-axis auto-sizes so the chart window becomes bigger.Have you tried opening the chart properties dialog and setting explicit
values for the Y-axis minimum / maximum property?
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"baldgeezer" <baldgeezer@.ntlworld.com> wrote in message
news:srIFe.9301$9r6.8482@.news.cpqcorp.net...
> Hi - does anyone know how to stop a chart auto-sizing? I need the chart to
> stay the same size. At the moment, depending on what data is graphed, the
> y-axis auto-sizes so the chart window becomes bigger.
>|||Yes I've set that (e.g. 0 - 100) but depending on the data graphed, the
physical size of the axis enlarges although the scale remains 0-100.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:OM25$eykFHA.1440@.TK2MSFTNGP14.phx.gbl...
> Have you tried opening the chart properties dialog and setting explicit
> values for the Y-axis minimum / maximum property?
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "baldgeezer" <baldgeezer@.ntlworld.com> wrote in message
> news:srIFe.9301$9r6.8482@.news.cpqcorp.net...
>> Hi - does anyone know how to stop a chart auto-sizing? I need the chart
>> to
>> stay the same size. At the moment, depending on what data is graphed, the
>> y-axis auto-sizes so the chart window becomes bigger.
>|||The vertical space available for the y-axis also depends on the length/space
needed for the x-axis labels. Unless you ensure the x-axis labels use a
similar amount of space (e.g. by restricting the string length of x-axis
labels) for various data values, the y-axis height may change.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"baldgeezer" <baldgeezer@.ntlworld.com> wrote in message
news:8%0Ge.9409$as7.5397@.news.cpqcorp.net...
> Yes I've set that (e.g. 0 - 100) but depending on the data graphed, the
> physical size of the axis enlarges although the scale remains 0-100.
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:OM25$eykFHA.1440@.TK2MSFTNGP14.phx.gbl...
>> Have you tried opening the chart properties dialog and setting explicit
>> values for the Y-axis minimum / maximum property?
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "baldgeezer" <baldgeezer@.ntlworld.com> wrote in message
>> news:srIFe.9301$9r6.8482@.news.cpqcorp.net...
>> Hi - does anyone know how to stop a chart auto-sizing? I need the chart
>> to
>> stay the same size. At the moment, depending on what data is graphed,
>> the
>> y-axis auto-sizes so the chart window becomes bigger.
>>
>

Friday, February 10, 2012

Changing values in a record

I have the problem of dynamically changing a field value in a row depending on the value of the same field in the previous row, assuming the table is sorted on that field.
:(
You may consider that field as a key of same sort as other values in the table do not help in selecting them uniquely.
Ex.
Before After
130 -> 130
130 -> 130A
140 -> 140
140 -> 140AIs the order of rows with "ties" arbitrary, or is there some hidden criteria that allows you to order them too? This is important, because it significantly changes the nature of the problem.

-PatP|||Is this a one-time data fix, or will this process need to be run regularly?

I assume, too, that data values such as 130B, 130C, etc... may also be required?

I have to say, it is rarely a good idea to create ID values this way (though I understand that sometimes the business model requires it), but it is also rare that a good application design requires stored data to be ordered in a specific manner, either logically or physically. Records should be independent from one-another.

I suspect that this is a case of either:
1) Poor application design.
2) A data-import issue.
3) A homework problem for a class.|||Yessss,
It is a problem of moving data from a legacy system (a whole lot of rubbish) into a new ERP. Business logics and data models are way different. Under this circumstances, a non-key field in the old system is now a key in the new model, from here the need of updating the values with a trailer character (or what have you). :)

Blindman, the values you mentioned are allowed, altough the repetition is often limited to two rows only. :o

Pat, there are no possible sorting orders because the other fields may vary 'randomly'.|||For a one-time shot, and given data that has no natural order beyond the field you are dealing with, a cursor may be a valid option.

Create a cursor that loops through the dataset order by your field, and that updates the field value if the prior field value had the same ID.|||If you don't have any other way to impose order on the rows, then a cursor is the only option that you've got left. Its messy and a "last resort", but it will get the job done!

-PatP