| Author | Topic | 
                            
                                    | CoachBarkerPosting Yak  Master
 
 
                                        170 Posts | 
                                            
                                            |  Posted - 2009-03-04 : 07:53:21 
 |  
                                            | I have weights that are returned from the db with leading zeroes in the field (LoadPounds 001234, LoadPounds 012345 instead of LoadPounds 1234 or 12345). What is the correct way to remove the leading zeroes?Thanks for the helpCoachBarker |  | 
       
                            
                       
                          
                            
                                    | sakets_2000Master Smack Fu Yak Hacker
 
 
                                    1472 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 08:39:40 
 |  
                                          | [code]select REPLACE(LTRIM(REPLACE('001234', ISNULL('0', '0'), ' ')),                    ' ', ISNULL('0', '0'))select convert(int,'001234')[/code] |  
                                          |  |  | 
                            
                       
                          
                            
                                    | sakets_2000Master Smack Fu Yak Hacker
 
 
                                    1472 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 08:42:44 
 |  
                                          | I don't know if you needed this done using reporting services. I just posted the sql which should do the same. |  
                                          |  |  | 
                            
                       
                          
                            
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 09:14:10 
 |  
                                          | isnt this enough?SELECT LoadPounds*1orSELECT LoadPounds+0 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | CoachBarkerPosting Yak  Master
 
 
                                    170 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 09:31:08 
 |  
                                          | I would like to be able to do this in the report not in the query.Thanks for the helpCoachBarker |  
                                          |  |  | 
                            
                       
                          
                            
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 09:41:33 
 |  
                                          | then just use=Cint(Fields!Yourfield.value) |  
                                          |  |  | 
                            
                       
                          
                            
                                    | CoachBarkerPosting Yak  Master
 
 
                                    170 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 10:17:51 
 |  
                                          | Returned this error message, I have 2 types of fields where I need to do this. One field is an int and the second field is a varchar(10).for both fileds the error wasThe Format expression used in textbox ‘textbox’ returned a data type that is not valid.I put this expression in the format property for the textboxes, is that where I need to put it?Thanks for the helpCoachBarker |  
                                          |  |  | 
                            
                       
                          
                            
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 11:29:27 
 |  
                                          | nope. you need to put it in value expression |  
                                          |  |  | 
                            
                       
                          
                            
                                    | CoachBarkerPosting Yak  Master
 
 
                                    170 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 12:15:04 
 |  
                                          | Thanks still trying to learn this on the fly. Now in the report this works for all the fields but 1, for example without using CINT() the value is 010731, using the expression it is 110731731 or if it is 0900021 it shows up as 990002121. Any ideas, this field is an int coming into the report.Thanks for the helpCoachBarker |  
                                          |  |  | 
                            
                       
                          
                            
                                    | CoachBarkerPosting Yak  Master
 
 
                                    170 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 12:43:44 
 |  
                                          | I got it to work.Thanks for the helpCoachBarker |  
                                          |  |  | 
                            
                       
                          
                            
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2009-03-04 : 13:00:37 
 |  
                                          | quote:are you applying any custom formats?Originally posted by CoachBarker
 Thanks still trying to learn this on the fly. Now in the report this works for all the fields but 1, for example without using CINT() the value is 010731, using the expression it is 110731731 or if it is 0900021 it shows up as 990002121. Any ideas, this field is an int coming into the report.Thanks for the helpCoachBarker
 
 |  
                                          |  |  | 
                            
                            
                                |  |