Dojo Grid and Enhanced Grid showing same value differently - dojo

The actual value of a column is N/A, after encoding using OWASP ESAPI the value is converted to "N/A". If we use Grid the value is showing properly as "N/A" where as for Enhanced Grind the same value is showing as "N/A". Why it is behaving differently, what is the formatter that grid is using. How to show proper value in Enhanced Grid

Related

Why did I have to manually set the .value from the .text on losing focus in an unbound textbox

I have an unbound textbox to accept the delete older than: number of days. It is in the report header. I set it to 30 days but I want the user to be able to change it. I was banging my head trying to figure out why entering 40 was not being accepted and it reverted back to 30 every time. I finally decided on using the lost_focus event to set .value to .text. That worked.
Further research showed that when the textbox get's focus text and value are both the same, 30 in my case. Changing the number in the text box to 40 shows the values of text at 40 and value at 30. Unless I specifically set Value to the value of text Access changes text to the value of value. This is different behavior than other places in Access such as forms.
Can anyone tell me why this might be? I can't find any setting that might do this. Is it because it's in a report header? what is the difference between this and every other text box I've ever used?
From a "best practices" viewpoint, Access Reports are not intended to be used interactively despite the ability to manipulate some unbound controls. Although workarounds can be implemented that function sufficiently well, such solutions are often incomplete and buggy and function differently depending on the active view: Report View vs. Print Preview. Appropriate design patterns include using Access Forms for specifying report options which then open the Report in a static configuration.
This may not satisfy the question "Why?" if seeking a deeper answer as to why Microsoft implemented inconsistent binding behavior in Access, or why they allowed interactive controls in reports at all if they don't behave the same way as in forms. But Access has plenty of other quirky behaviors that have no known/published explanation.
Regarding the priority of the Value property updating the Text property (and not vice versa): Value is the key field because it contains the actual data for the control (bound or unbound). Although it is natural to have a single control for both display and input (uh, that's how almost all controls work), the processes of displaying data and parsing user input are two distinct functions. The visual representation returned by the Text property can be manipulated using the various formatting properties, and technically could display an incomplete representation of the underlying Value data. If there are any conflicts between the stored Value property and the Text property, it is natural that the existing Value property has precedent.
My guess is that the automatic binding behavior was "relaxed" for reports to allow more flexible custom reporting output. First consider an Access Form in Datasheet view: An unbound Form control shows the same value for all records. Even if the control is edited while on a particular row, the updated value is displayed for all rows. The same control object is essentially repainted for each row and there is no concept of individual instances of the control that can hold different values. Bound controls have built-in code that repaint the control with data from the particular row, but there are still not multiple instances each "holding" the individual values. The visual output differs from an intuitive object-oriented paradigm where our minds what to assign each visual row its own in-memory instance of the controls--it just doesn't work like that in Access.
Unlike the Form behavior just described, the Report's Print Preview (and actual printed output) allows unbound controls to display different data per row using the Detail_Format() event. Within the Detail_Format() event, one can set the Value property of a control at which time the Text property is automatically updated according to various formatting properties. This update Text is then output for the current row. Perhaps (just guessing) that this behavior would not function properly if the Text property updated the value property. I suspect it would cause recursive events during report generation. Because reports are not meant to be interactive, relevant text-input parsing code was "disconnected" so that it doesn't behave like on a form.
All that explanation doesn't make Access any less frustrating nor remove its limitations, but at least learn to adapt and design things in the "Access-esque" way rather than fighting it.
your best bet is to design a form with the unbound combo boxes and have your data displayed in a subreport. I like to design my reports so that when values are updated the query for the recordsource of the report is generated doing this requires 2 queries to exist, one with all data possible and a filtered one as subreport recordsource. This will control the data for printing and also allow users to close or navigate away from the report and return to the data later.
Private Sub ComboBox1_AfterUpdate()
Dim Query1 as Object
Dim Temp_Name as Variant
Temp_Name = SubReport.SourceObject
SubReport.SourceObject = Empty
Set Query1 = Me.Form.Application.DBEngine.Workspaces(0).Databases(0).QueryDefs ("SubReport_Query")
Query1.SQL = "Select * Unfiltered_Query WHERE Field1 <= " ComboBox1 & ";"
SubReport.SourceObject = Temp_Name
End Sub

visibility expression in report builder with multiple hidden values

I have an image that i would like to hide based on a value. This value can have 3 possible returns. "AP02", "AP16", "" (blank). I want the image visible only if the value is "AP16"
Currently i am using this code:
=First(Fields!LastMPClientName.Value, "ClientSummary")="AP02"
The above works if the value is "AP02" however i am seeing more and more blank values for my clients.
How can i make this image hidden for both "AP02" and "" values?
I am using report builder 3.0 from a SQL 2008R2 instance.
Cant you use an OR?
=First(Fields!LastMPClientName.Value, "ClientSummary")="AP02" OR First(Fields!LastMPClientName.Value, "ClientSummary")=""

BIRT result set values in specific cells

My query returns location_cd(string) and item_count(int). I only need certain rows from the result however and I need them to display in specific places in my layout so I don't think the table solution is going to work. Can I determine where I place the value for a particular row of the result set?
I am using a grid to display values for a number of fields. I cannot seem to be able to get the values from the results to show. The grid is bound to the result set. I even tried binding the cells to the result set but that didn't work either.
I checked in the query editor and there is a result set shown in the Preview so I know the query works. The complete and correct result set shows if I put a table on the page.
I tried inserting a Dynamic Text or Data object in a cell and used the expression:
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:""
This returns a blank and does not seem to evaluate. I tested it with :
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:"BLANK"
and got 'BLANK' to appear in that cell.
dataSetRow["location_cd"] and dataSetRow["item_count"] will display the location_cd and item_count from the first row of the result set. row.outer[] did the same thing. Obviously I am just hacking at this report at this point.
A co-worker suggested that she uses a JAVA if-statement in places like this but I could not get that to work either.
Any ideas or suggestions that will get me on the right road??
Thanks
An elegant option would be to use a HashMap storing the result of the dataset.
Declare a report variable named "values", with a new hashmap as default value (see image below)
Fill values in the onFetch script of the dataset: vars["values"].put(row["location_cd"],row["item_count"]);
Insert new data elements at any place of the report with expressions such: vars["values"].get("myFavoriteLocationCD");
Though it is important to note the dataset should be triggered by the report before these data elements.
The particular row you want to display you specify in a "Text" field inside your grid. Just drag and drop a "Text" field inside your grid. If you bound the fields you want to display to your grid, the "Text" field inside the grid inherits the bindings of its parent (the grid), so you can access the bindings automatically in the "Text" field.
You could try following steps, maybe that works.
Don't use "Dynamic Text" field, instead use a regular "Text" field
Ensure the fields of your query which you use, are bound to the grid (you sayed you already did)
Open the "Text" field
Change preselected pull-down entry "Auto" into "HTML"
Change preselected pull-down entry "Formatting" into "Dynamic Text"
Wrap your code in <value-of format="HTML"> your code goes here... </value-of>
Note: You should check in the "Expression Builder" of your "Text" field if you are able to access the fields you bound to the grid. If they are not available sth. went wrong with your binding. Avoid binding query records to cells this will drive you crazy.
If you want to display a list, ensure you didn't set a constant height in the row of your grid. Set the height to 100% than the row takes its height dynamically.
What about the idea to optimize your query, that only get the results you want are displayed, than you don’t need to filter them with java script? If you don’t need the filtered results in another place this would be the cleaner solution in my opinion.

SSRS Color literal not working in variable expression

I'm trying to create a custom template report so that reports inheriting from it will use corporate standards for color and font. I want to create report variables for these, so that the same color can be employed in different parts of the report.
For instance, in the report header properties, I set the RGB values for the BackgroundColor property and, when I save my changes, I see a literal value in the property text box. If I then open the dropdown for the property again, and click the "Expression..." link, I see a numeric literal - in this case, #006a4d, which is a dark green. (I'm somewhat new to SSRS expressions, but apparently expressions that represent numeric constants don't require the "=" sign at the beginning.)
This tells me the constant representing the RGB combination that I want. Now, I go into the Variables tab of the Report Properties dialog and create a variable called "BckndClr" with the same hex constant as its value.
If I then go back to the BackgroundColor property and set it to the expression:
=Variables!BckndClr.Value
and save it, I find that, instead of continuing to to be dark green, the report header's background color in the Design tab has changed to the Auto default (white) color.
If The Visual Studio properties dialog displays a value for a literal color expression, why can't I use that same value in a user-defined variable and set the property expression to that variable?
What you are calling the "literal color expression" (#006a4d) is the hex value of the color. You can use this website to convert your RGB values to hex. Not sure what version of SSRS you are using. I duplicated your steps in with SQL Server 2012 SP1 using SQL Server Data Tools for VS 2012.
Created a variable in the report properties. Called it test. Pasted the hex value directly into the value box without clicking the expression button.
Went to the header properties, clicked on fill, and then clicked on the expression button next to the fill color. Enter =Variables!test.Value as the expression. Click OK.
Preview report. And verify the color of the header is dark green.

Invisible column in GridX?

Is it possible to create a column in GridX that will be invisible and not rendered? I don't want to simply hide cells with CSS because it's not elegant and it can have side effects.
Invisible columns are usefull, because for example, in onApply event from cell editor, I become a row data that contains only those fields from dataStore, that are declared as column.
Is there such feature in GridX as invisible column?
I'm using Dojo 1.9 with GridX 1.2.
There is a hidden columns module:
gridx/modules/HiddenColumns (version 1.2)
Hide columns and change the column array at the same time so that other grid features are not affected by hidden columns. That means, hidden columns can no longer be accessed through grid.columns() function.
Update -
I played around with the test GridX here and the least width it goes up to is 20px. However this email from one of the developers actually suggests that this might not be possible at all!
Earlier -
Have you tried building the grid with ColumnResizer module, and, selecting the required column, and, using the setWidth() method to set the width to zero? - this does NOT work.