Solved! Go to Solution.
Solved by jabowabo. Go to Solution.
The default reports all (I think) have a function for converting. All you need to do is make sure your quantity cell calls the function in the scripting area.
1. Find the cell name (tableCell4 in this pic):
2. In the Scripts section, change the original cell function to your cell name (just change 'tableCell4' as shown below) or Copy/Paste the function and change the cell name to yours:
Excel is changing it. When you export select the 'Text' option.
So i have tried this sveral times in plant report 2017 and cannot get it to work. Has somthing changed since 2014?
So i have tried this sveral times in plant report 2017 and cannot get it to work. Has somthing changed since 2014?
I'm still on 2016 so I don't know if it works on newer versions.
So here are a couple of screen shots. Maybe it will help pin point if I am doing something wrong.
Thanks for the catch. So i am new to scripting. What are the OOTB reports and where would I find them? Thanks for the help
Thanks for the catch. So I am new to scripting. What are the OOTB reports and where would I find them? Thanks for the help
Thanks for the catch. So I am new to scripting. What are the OOTB reports and where would I find them? Thanks for the help
Out of the box - these are the default reports that the software comes with - although I did not see the missing code in the few I checked. Here's the full code from one of my old reports (I only report decimal feet now so it can be calculated in Excel). You will need to modify to suit your report layout. Make sure the 'SummaryCalculated' event of your length cell points to the method 'tableCell5_SummaryCalculated'.
// Return the specified object as a double value formatted // into feet and inches. // private string feetInchesFromObject(object obj) { System.Diagnostics.Debug.Assert( obj != null, /*NOXLATE*/"feetInchesFromObject: obj parameter is null"); if (obj == null) return string.Empty; double value = System.Convert.ToDouble(obj); // Round the initial value to three decimal places // to avoid borderline rounding cases than would // have resulted in very small or very large fractional // inches. double inchesFull = System.Math.Round(value % 12, 3); double inchesOnly = System.Math.Truncate(inchesFull); // Compute the fractional inches, if any. string fracText = string.Empty; double frac = inchesFull - inchesOnly; if (frac > 0.0) { fracText = string.Format( /*NOXLATE*/" 1/{0}", System.Math.Round(1 / frac) ); } // We always include the feet and inches. // The fractional inches are optional. return string.Format( /*NOXLATE*/"{0}'-{1}{2}\"", System.Math.Truncate(value / 12), System.Convert.ToString(inchesOnly), fracText ); } private void tableCell5_SummaryCalculated( object sender, DevExpress.XtraReports.UI.TextFormatEventArgs e) { textFeetInchesIfColumnImperial(/*NOXLATE*/"MeasureUnit", e); } // Convert TextFormatEventArgs.Text to feet and inches // if the specific column value indicates imperial // units. private void textFeetInchesIfColumnImperial( string unitColumnName, DevExpress.XtraReports.UI.TextFormatEventArgs e) { // Validate unitColumnName parameter. System.Diagnostics.Debug.Assert(unitColumnName != null, /*NOXLATE*/"textFeetInchesIfColumnImperial: unitColumnName is null"); if (unitColumnName == null) return; // Validate TextFormatEventArgs parameter. System.Diagnostics.Debug.Assert( e != null, /*NOXLATE*/"textFeetInchesIfColumnImperial: TextFormatEventArgs parameter is null"); if (e == null) return; if (e.Value == null) { // We have no value, so do nothing. return; } string mu = GetCurrentColumnValue(unitColumnName) as string; if (mu == null) { // We cannot determine the unit, so do nothing. return; } if (mu.Trim().ToUpperInvariant() == /*NOXLATE*/"IN") e.Text = feetInchesFromObject(e.Value); }
NOTE: I probably owe some/all credit for this code to someone but I can't remember where I stole it from 😉
Okay I created a new template from existing OOTB templates. 3D parts to be specific. I am still getting the same error.
Okay that worked and everything was validated. My test report comes out tableCell5 as still in decimal inches? Again thanks for your help.