MS ACCESS Report - Using CODE to change a value in a field from an OPTION Group to a different value - sql-server

I have a report in ACCESS that Is based on a query of a table populated by a form with an Option group. ( to try to explain this better - Table is inspector qualifications, the query pulls all of the qualifications for the inspector, the qualifications are selected via option group on a form that populates the fields of the inspector qualification table.) Of course, the choices are stored as numeric values, "1, 2, 3 or 4" in the table, but 4 actually designates a N/A or NONE. Since everything is already built out this way, I am trying to write a code that will run when the report is generated (or opened,) that will take the "4" value entered (if the field equals that) and change it to a Null value /blank in the report - not in the query or table. I still want this report to generate everything else as is - show all records - just change the value if that particular option is the one shown in that field for that particular record.
Anyone know of a good way to do this? Any help would be GREATLY appreciated!!!!

You would just place an 'IIF' in the query that tests for the value you want to change, then either changes it to something else, or retains the original value. The below will test field 'Nbr1' for the presence of a 4, and if found, change it to 'N/A', otherwise it stays the same.
Note! You will need to change the control source in the report to reflect the name you provide (i.e. 'MyChange') because you can't keep the original name.
SELECT Table1.ID, Table1.EMPID, Table1.TestResult,
IIf([Nbr1]=4,"N/A",[Nbr1]) AS MyChange, Table1.Nbr2
FROM Table1;

Related

Where does the value of 'Last changed on/by' is stored for any element in 'se11' (Inside attributes tab)

I want to find out 'last changed on/by' for a large number of elements going in 'se11' and checking it's attribute value .
So instead of copying each elements name and checking it's attribute for the same value, is there any table or database in which i can get the values for multiple entries at once?
Picture is attached in the question for the reference.
With the cursor placed in the field you're interested in, press F1, then select the technical info. This will show you the table name or - as in this case - a structure named RSDXX, which is not what you're looking for - but it is the fastest way in some cases.
Alternatively, start transaction ST05, enable the SQL trace and navigate to the display in a separate window. Then stop the trace and examine it - you will find a list of all tables accessed for the process. Very near the top of the trace list, you will find a table named DD02L which is the one you're looking for in this case.

Printing records with condition Crystal reports

I am using stored procedure in mssql as backend, vb.net as frontend (just info).
There are a lot of records in the database and I am printing in crystal reports.
Now I want to filter the records from crystal report and not by adding a new parameter to procedure or changing database structure or else.
For now,Say there are columns : Name , Amount.
I want to put filter in amount like only display records whose amount above 100 or something. So other records with less than 100 should not be displayed.
This filter will be passed by the user so it'll be random.
I can't find a proper answer on internet. Might be a duplicate question, if so please post the link of the question if it is duplicated.!
Thanx anyways...!
In general the idea is to:
Create the parameter (user choose what will be the input/value) - link
Set filters, what values should be displayed in regards to parameter - link
On right side there is a DataExplorer window, where You need to add a Parameter (define his name, what question will be shown to user and what type the param will be / what values can be set inside).
Once done, You can jump to Data tab of a report, click Interactive Filter and specify which column must fit what condition with what value = Parameter (that one user will enter in Report).
Example: I will create AmountParam, with message "What should be the minimum amount?". Type will be set to Integer. Going to Report->Data->Interactive Filter, choose Amount as a Column, AmountParam as a Parameter and set condition Greater then (>).

FileMaker Pro 13: How to get a summary variable to display an accurate total

I am working on a database of records that includes a step that only needs to be performed for some of the records (about a fourth of them). To keep track of which records needs the extra step, I created a boolean field with 0 for "doesn't need the step" and 1 for "needs the extra step" (these are assigned before importing the information into the database). There is also an option for the user to click a button and change the boolean from 0 to 1 (in case the record needs the extra step in the future).
The database also has a report feature that shows the total number of records that needs this extra step. I need this field to display the current total number of these records, so I have tried setting up a summary variable called Total PLQA that is defined to give the "Total of" and then the boolean variable (PLQA Bool). Somehow, I got the total to work once, but it seems that the reporting variable "Total PLQA" does not update when new records are added to the database or when users change the boolean value. Somehow, I need to get the variable to update whenever the report script is run and I can't figure out how to get it to work.
I have tried setting up a summary variable called Total PLQA that is
defined to give the "Total of"
That would be a summary field, not a variable.
it seems that the reporting variable "Total PLQA" does not update when
new records are added to the database or when users change the boolean
value.
A summary field always displays the summary value for the current found set (unless you place it in a sub-summary part, where it will display the sub-summary value for each sorted group).
Make sure your report layout is based on the same table where the summary field is defined, and that the summary field's instance placed on the layout is coming from the same table occurrence.
Note also that:
After import, only the imported/updated records will be found;
If you modify the Boolean field, you must commit the record before you will see the summary field reflect the change.

Detect when (Select All) is checked for multi value parameter

I have a report with a multi-valued parameter on it. I'm looking to output the selected values which is accomplished with Join(Parameters!State.Label,",")
Every solution I've found on the web indicates I should use something like the following to detect when the (Select All) "value" is selected.
E.g. expression for the text box on the header should be:
="State: " & IIF(countrows("prc_prompt_state").Equals(Parameters!State.Count),"(All)",join(Parameters!State.Label,","))
CountRows() tells me the total number of parameters available, e.g. 8 states in Australia. Parameters!State.Count is supposed to tell me how many are actually selected by the user. However this always reports the full value (8 in this case) regardless of how many are selected. This is in agreement with the official docs (https://technet.microsoft.com/en-us/library/aa337293(v=sql.100).aspx), but NOT in agreement with every single search result I come up with on how to solve this problem.
So how can I rewrite this expression so I can find out when (Select All) is/isn't checked? I'm using report builder 3, which I believe is based on the 2008 edition - we deploy to Azure, but I haven't got that far yet.
Examples of questions whose answers seem to be wrong:
Displaying Multi-Value Parameters
SSRS: Can I know if user selected "ALL" in multivalued param?
This is old, but google found it for me, and then I figured out an answer on my own that worked. (I was using a list of users.)
I created a separate dataset that returns a count of all available options in the default parameter lookup (username). Then, I assigned that as a default value to an internal parameter. (UserCount) This worked as a text expression:
=Microsoft.VisualBasic.Interaction.IIF(Parameters!username.Count = Parameters!UserCount.Value, "All Selected", Microsoft.VisualBasic.Strings.JOIN(Parameters!username.Value, ", "))

How do I get the Proper Item in a Delphi DBLookupComboBox to be Selected

I have a DBLookupComboBox that is wired to a database query. That part is working fine. When I run the program the DBLookupComboBox is populated with the results of the query. I'd like to to see the DBLookupComboBox populated with the first item "Please Select" when the program first runs or when a new item action is initiated. (See below image)
Also, if I'm loading a previously saved database record that had selected Index 2 "Quick Elimination" how would I get the DBLookupComboBox to display that selected entry?
Yes, "Please Select" is index 0 and it is retreived as part of the query.
You could try this (I know you've probably solved it by now, as you asked over 2 years ago), but in case anyone else was interested...
dbluLookup.KeyValue := dbluLookup.ListSource.DataSet.FieldByName(dbluLookup.KeyField).Value;
That simply sets KeyValue to the first record in the ListSource dataset, which should be the row 'Please Select'.
My guess would be that the value of the underlying table field is NULL rather than zero, which tells the DBComboBox that no value has yet been selected and it displays accordingly.
If the value in the table were zero, I thinkg the text in the edit field of the combo would be selected to indicate that, but I may recall this incorrectly.
Anyway, just check for Field1.IsNull (or IsEmpty) and then set it to zero. It does mean that you can no longer distinguish between an "unknown value" (NULL) and "no selected value" (zero), unless you prevent the zero value from making it back into the table...
One way of doing this would be to add 'Please select' to the underlying table from which you are selecting, where the key to this tuple would be 0. Then when you display the combobox and the value of the connected field is 0, 'Please select' would be displayed. Of course, you have to make sure that this value is never selected!
The DBLookupComboBox displays by default the ListField(s) whose KeyField in the ListSource matches the DataField in the DataSource. So, to ensure to display some value for the DataField being NULL, you have to provide a KeyField of NULL in the ListSource. But one could imagine not wanting a NULL value in the underlaying table associated to the ListSource.
One way to circumvent this is to add the NULL value to the dataset behind the ListSource with a UNION SELECT. That should work just fine, since that dataset does not have to be editable.
Now, to assure this special dataset is only available when you are adding a new record to the dataset associated to the DataSource, manage the query for ListSource.DataSet in DataSource.OnStateChange. When DataSource.State = dsInsert, then update ListSource.DataSet.
Modification for Steve Childs answer in TwwDBLookupCombo, InfoPower component
cboFilterTravel1.LookupValue := cboFilterTravel1.LookupTable.FieldByName(cboFilterTravel1.LookupField).Value;
Thanks Steve It's works for me

Resources