Remove commas in group tree - vb.net

I created a report in a VB.Net application and I'm using the Crystal Reports Viewer control to display it. The report is grouped by a field that's an integer datatype. I've been successful in formatting the field to a string so that it displays properly on the report (i.e., without any thousdand separators or decimals).
The problem now is that when I open the Group Tree in the viewer, the field is being treated as an integer (with the thousand separators). I've attempting following the solutions in these articles article1, article2, article3, but they only address formatting the display of the field (which I'm not having a problem with).
So how to I format the display of an integer as string on the Group Tree, not the report itself?

Go into the Group Expert, select your group, and hit "Options". Select the "Options" tab, and then mark the checkbox that says "Customize Group Name Field" and then select "Use Formula as Group Name" and finally enter the formula totext({table.field_you_are_grouping_on},0,'') This will change group's appearance everywhere, including in the tree.
Note that the second parameter to totext controls the number of decimals and the third parameter controls the thousands-separator (empty string, in our case).

Create a formula for the group like this:
ToText({table.field},0).
It will remove any thousands separators. I use this all the time.

Related

How to check if an OLE object has been printed in the Crystal Report?

I have placed a picture (OLE object) in the group footer and I need to check whether this object is printed in the current worksheet or not. So basically I want to detect the end of group and update an object (string) which is placed in the group header. Is this possible in the formula editor?
This is not possible using regular formula logic.
But if you know the group header always starts at the top of the page, you could try to compute the vertical space required by the following sections (by knowing their heights and number) and use that information to figure out if the page has enough remaining space for the group footer.
Yes, the content of the report is dynamic but you can compute the required space by knowing how many items are in the group. For example, if the only section under the Group Header is the detail section, and the height of the detail section is X, and the number of records in the group is 10, then the vertical space is 10X.

SSRS export to Excel force number to be a text value

Using SSRS
All the other questions are how to force the number to show as a number instead of text when exporting to Excel
Meanwhile I want to force the number to show as a text so that Excel does not turn number 6158.30 to 6158.285 which is causing me round up issues.
My SQL uses cast to 2 decimal places CAST(ROUND(Net, 2) AS decimal(18,2)), in Excel it shows as 6158.30 but when you click on the cell its showing 6158.285.
I have tried concatenating ' + value but it exports the data as 'value and NOT force the cell to show as a text data.
I don't think it makes sense to try to turn the number into text, when all you are trying to do is to prevent the number displaying with more than 2 decimal places in Excel.
From the behavior you have described, it sounds like that for the textbox, you are currently using an SSRS expression like:
=Fields!Net.Value * 148.5
and using the Format property of the textbox to display to 2 decimal places.
Instead, for the SSRS expression, try:
=Round(Fields!Net.Value * 148.5, 2)
No need to set the textbox's Format property (unless you want commas etc).
Then that textbox column should stay as a number to 2 decimal places, when the report is generated to Excel, and the cell selected.

Formatting Unbound Text Box with Value from ComboBox

Novice / Intermediate Access User.
I have a form in MS Access (O365 ProPlus) which has a ComboBox based on six column query.
AfterUpdate, I want to pull the Value from column of the ComboBox and populate it in an unbound text box. However, the formatting needs to be Currency and it's not carrying over correctly from setting the Currency formatting in the Form Properties Field for the Textbox.
I have tried formatting in the Control Source property when pulling the ComboBox column values that way which had limited success. It displayed the Currency format but when I try to use the value in the textbox later to be used in a calculated (Sum) total value field elsewhere on the form, it is only recognized as text.
The TotalValue Textbox only concatenates the textbox(es) with currency dollar signs.
Combobox1_AfterUpdate: ()
Textbox1 = Combobox1.Column (2)
Textbox2 = Combobox1.Column (3)
Textbox3 = Combobox1.Column (4)
TotalValueTextbox = Textbox1 + Textbox2 + Textbox3
Expected results are one number adding up numerical values of the aforementioned text boxes. Instead I get number1number2number3 as if I am concatenating text strings.
Currency format (if it works in preceding text boxes) comes with the dollar sign but decimals don't carry and it concatenates the values in lieu of adding them.
I even tried adding a tertiary test textbox and made its Control Source value equal to 12 times (arbitrary value) of one of the Textboxes and it multiplied correctly, but when multiple text boxes are involved using sum calculation as listed above it didn't work.
Problem is, that a combobox always returns text. If you feed it with numbers or currency, these will formatted using your default settings.
So, add some extra columns to hold your amounts with no currency formatting but forced to text using Str. In your source query of the combobox, add three columns:
Column5: Str([Amount1]
Column6: Str([Amount2]
Column7: Str([Amount3]
Then use convert the values to numbers with Val:
TotalValueTextbox = Val(Combobox1.Column(5)) + Val(Combobox1.Column(6)) +Val(Combobox1.Column(7))
Finally, specify the Format property of TotalValueTextbox as Currency and, in Combobox1, set the column width of the extra columns to 0 (zero).
Using Format() function with Currency parameter results in a string with a $ sign character. Plus (+) character is a concatenation operator left over from old BASIC as well as arithmetic operator. Concatenation will have priority in some situations, as you encountered with textboxes on form.
Instead of formatting data on form, put $ in a label next to textbox.
Otherwise, calculate with direct reference to combobox columns.
= Combobox1.Column(2) + Combobox1.Column(3) + Combobox1.Column(4)

LibreOffice writer field calculations

In a LibreOffice writer document with a field of #temperature_farenheit. Is there a way to create a field named #temperature_celcius that would automatically calculate and insert the correct temperature?
And if this is possible, what types of fields do I use and how do I reference them for purposes of calculations.
This can be achieved with user variables. I'll give a start-to-finish example in painful detail for clarity, and hopefully universal applicability to other cases.
Open a new text document.
Enter some text like Water boils at °F (°C).
Put the cursor before °F where you would normally type the number.
From the menus, choose Insert→Fields→More Fields…
Go to the Variables tab. Choose Type: User Field.
Below that, you'll see each User Field gets a Name and a Value. It will not appear in your document, but enter a Name for this variable we're using to store "water's boiling temperature in degrees Fahrenheit," lets say: BoilF
Enter the Value you want stored in that variable, and accordingly shown in this field in the actual document text. Here, its: 212
Click the Insert button to actually add the field to your document. You should see 212 appear in the text.
You've now added the field, but also created a variable that can be used elsewhere. Now to do the math and use it elsewhere:
Leaving the Fields window open, put the cursor before °C.
In the Fields window, select Type: Insert Formula.
Below that, enter the Formula: (BoilF-32)*5/9
Click the Insert button. You should see 100 appear in the text.
Should you ever need to update a number pair, double-click the first number—that is, the User Field in your text. Example steps, using the above starting point:
Add to the sentence so it reads
Water boils at 212°F (100°C) atop Everest.
It's now wrong, so double-click 212.
The Edit Fields window will appear. In the Value box, enter 154.4 and click the OK button. It will do the math and both temperatures will update in the text.
Water boils at 154.4°F (68°C) atop Everest.
Be mindful of variable names. If you have 20 temperatures scattered through your text, you should in turn have 20 user variables, with thoughtfully-chosen names.

Format Text to Number format in Report Builder 3.0

I am working with 4 fields in Report Builder 3.0 in which I am trying to format as a number with the corresponding comma. When I use the number format in the Text Box Properties nothing happens. When I export this report to Excel the field has to be converted to a number as it is being exported as a text field.
Do you have any suggestions as to how I can change the formatting in the report itself?
Thanks for your time!
If I pull data from Oracle using an openquery I get the same issue. To resolve:
When you have the Text Box Properties box open, select the function key by the Value.
In the expression, add "Int" at the front of the string with () on each side of expression. (This converts the value of the expression to an integer)
Ex: =Int(Fields!Count.Value)
Close the expression box after making these additions and select "Numbering" in Text Box Properties to format the text box accordingly.