How to format currency in string field in pentaho designer - pentaho

I have this formula in value of text element. how can I format the amount to format this $#,##0
=IF([amount]=0;"N/A" ;"$"+[amount])
I want the amount should be formatted in report. how can i change the expression to get that.

Related

How to conditionally format date cells in a matrix in quicksight?

Can not seem to conditionally format date values in quicksight. What am I doing wrong?
My date fields are in the date format and I have added them to a matrix as shown and when I try to conditionally format using 'Add background color' the pop up does not even open.

how to change time format hh:mm in rdlc report expression

How to change time format hh:mm (military time format) in RDLC report expression if my dataset field data type is (string, time or TimeSpan).
I am using this format =FORMAT(First(Fields!Time.Value, "dataset"),"hh\.mm") but it is not working.
Please let me know how to solve this issue because I do not want to modify Stored Procedures.
Your solution can save my time.
Go to textbox properties and set format value to "HH:mm"
you can change it from Text Box Properties dialog:

Can an unbound text box containing a string be set to equal a date(time) field programatically?

Alright. The goal is to programatically grab a string of numbers from an unbound control on a form. Why? I have a form that contains two controls for a start time and a finish time. The format for these controls are dd/mm/yyyy hh:dd. The end users are complaining that they hate having to take the time to enter the date and time in a single field, especially considering the old form (a horrible Excel spreadsheet where users could type whatever they felt like typing), allowed them to just type the 4-digit time. I am trying to replicate that experience, but as we know, date and time are wrapped into one field in Access.
The idea is to supply the date/time field with the values from the string using separate unbound control. For example, one control will be labelled 'Start Time' and will accept 4 numbers with an input mask of 99:99. Before the form is updated, I would like to pass the string from the control Unfortunately, I do not have the code, but I will attempt to build psuedo code here:
Class Level Module
Private Sub Form_BeforeUpdate(Cancel As Integer)
strStartTime as String
strFinishTime as String
strDate as String
rstDailyLog as recordset
Set rstDailylog = CurrentDb.OpenRecordset ("Daily Log" dbOpenDynaset)
'assign variables to unbound controls on form
strStartTime = Me![Start Time]
strFinishTime = Me![Finish Time]
'Here, I assume I begin parsing my string to the date/time field
'function to edit send the string to the actual date/time field
'Basically, copied from Microsoft Docs
Sub EditName(rstCovertString As Recordset, strStart As String, strFinish As String)
With rstConvertString
.Edit
![Start Time] = strStart
![Finish Time] = strFinish
.Update
.Bookmark = .LastModified
End With
What are the implications of doing so? For example, if the bound form displays a record with an unbound value, how will that record display the desired data?
As I was building this code, I just realized that the field that holds the date/time is a date/time data type?
Now I am really confused. If they are different data types, can I even send my start/finish variables to that control as a string?
It turns out that Access does a TRUCKLOAD of data type conversions for you.
When text box controls are bound to a underlying table, then that text box will return a datetime data type. Even if you stuff in a string - it gets converted to a datetime data type behind the scenes.
And same goes for text, or if the control is bound to a number. (again, data type forcing is actually occurring here. However, VBA is rather forgiving in this regards.
Thus, most of the time you don't notice this issue.
HOWEVER, WHEN the text box is NOT bound to a underlying table, then the data type of that text box is more loosely goosey.
So, set the format of the un-bound text box to date format. If you do this, then even assigning a string value to the text box will cause access to convert the string into a date time. In fact, your code should STILL take the data from that table, and if you are not directly assigining the date column to the text box?
Well, then format the string as USA format.
eg:
me.MyStartDate = format(dtValue, "MM/DD/YYYY")
or
me.MyStartDate = format(dtValue, "YYYY-MM-DD")
You will find that EVEN if your date format is different then above (say based on your computers regional settings), then Access will convert the above to an interal date format, and THEN display what your regional settings are REGARDLESS of the above.
So, your display might be:
DD/MM/YYYY (day first)
But, doing this:
me.MyStartDate = dtvalue
or
me.MyStartDate = format(dtValue,"YYYY-MM-DD")
will work.
So, do NOT convert the datetime value from the table into a string IF POSSIBLE to avoid doing so.
So, you simply assign that actual datetime value directly it to the text box. As long as Access sees and knows that text box has a date format, then it will assume and work with that text box as a date time data type.
The above ONLY works if you set the un-bound text box to have some kind of date formatting. Once you told access that the text box is a date type text box, then directly assign date values from a table (without conversion to a string) is your BEST solution.
As noted, for bound text boxes then the text box will take on the correct datatype - even if you don't format the text box.
And the same above trick also applies to number formats. And thus setting a number format for the text box will result in that text box NOT being a string/text type, but an actual number.
So, you can force/set un-bound text boxes to a given data type by use of the formatting option. Once you do this, then you should not need to format data from a table, but in fact just shove the actual date value into the text box. You can (and should) thus now be able to set any kind of date formatting you want for the text box - even setting that is the exact opposite of the actual date format your computer (and user) has chosen on a whim.
In other words, if you do this correct?
Then you don't care, or even have to know the date format settings on any given computer, and your code will always work.
Of all the suggestions here by me?
If possible, assign the actual date value to the text box, and do NOT format the string. This will allow you to set any kind of date/time format for the text box.
Once you defined/set the text box to be a date format, then it is a datetime thing and data type. As a result, you should not require any conversion from the table data to set/fill out the text box.
Edit
You have:
'assign variables to unbound controls on form
strStartTime = Me![Start Time]
strFinishTime = Me![Finish Time]
No! - declare the above two vars as date, not strings.
dim dtStartTime as date
dim dtFinishTime as date
now:
dtStartTime = Me![Start Time]
dtFinishTime = Me![Finish Time]
'Here, I assume I begin parsing my string to the date/time field
No, don't parse. You have the data as a internal datetime. How you display this data is up to you or the users regional settings. As a developer, it is a date type and a date "thing". Don't convert to string!!!
'function to edit send the string to the actual date/time field
'Basically, copied from Microsoft Docs
Sub EditName(rstCovertString As Dao.Recordset, dtStart As Date, _
dtFinish As date)
Access will often recognize a string with a date/time structure as a date/time value. Could use CDate() function to be sure or use # delimiters.
Do these tests in VBA editor immediate window.
?IsDate("1/1/2020 14:50")
?IsDate(CDate("1/1/2020 14:50"))
?IsDate(#1/1/2020 14:50#)
?IsDate("1/1/2020" & " " & "14:50")
All return True.
If you want to display the saved date/time then bind a textbox to the field. Lock the control if you don't want users to edit in it. Then use VBA to save any edits done in the unbound textboxes. I recommend AfterUpdate event for code to save. Use BeforeUpate event to validate user input.

Changing the Currency Symbol in Pentaho

I created an anlysis report in pentaho user console. I had some revenue and profit measurements in the data set. So I need to add the currency symbol to those values. But in pentaho I can only add $ mark. How can I change to other currency symbols as I am interest in?
In the Analyzer Reports simply you can change the currency symbol by editing the format of the field. Change the format of the field into currency and type the symbol you want.
Click on the filed name.
Select Column name and Format.
Change the format to currency
Type/ paste the currency symbol you want in the Symbol text box.
Click OK.
Now it will change the currency type only for that report.
Or you can change the default currency symbol of the Analyzer report by following the below steps.
Stop BA server
Go to ...\server\biserver-ee\pentaho-solutions\system\analyzer
Edit analyzer.properties.
Change renderer.currency.symbol attribute from $ to desired currency.
Save the changes.
Re-start BA server.

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.