How to match text to a defined numeric value - ms-access

I have a database that has a bunch of survey data that I would like to work with. For several questions, the values are things like "Very important","Not at all likely" and I want to create a calculated field to assign a numeric value to these responses.
I don't want to replace the responses at all since I am going to have a user fill out a form to append the data set. I do want to have a calculated field that will automatically assign a numeric value to a text response.
I would just use a vlookup or an IF function in Excel to do this, but the problem is that Excel can't handle as much data as Access can. I need to set it up so that all Excel will house is a pivot table from the Access database.
Could anyone please tell me if there is a good way to do this? I am just not sure how to do it.

Create a new table with 2 columns: user_value (text) and numeric_value (number). Get all of the user entered values uniquely from the user entered data table with a query (the sigma symbol gives you a group by query). Put these in your new table and assign a numerical value to them. Then you can create an output query which joins your data to the lookup table and retrieves the numerical value for each user entered value.

Related

Lookup Fields MS Access

I am somewhat new to MS Access and I have inherited an application with a table that uses this Lookup feature to replace a code with a value from a query to another table.
When I first used this table and exported it to Excel for analysis, I somehow got the base ID number (or whatever it would be called) rather than the translated lookup value. Now, when I do this, I get the translated text. The biggest problem is that while the base value is unique, the translated values are not, so I cannot use them for the work I am doing.
Can someone explain how to get the underlying ID value rather than the lookup value? Is there some setting I can use or some way to reference the field upon which the lookup is based. When I query the ID field, I get the lookup value. I know that the first time I did this, the spreadsheet contained the ID number not the text.
For now, I created a copy of the table and removed the lookup information from this copy, but I know I did not run into this when I did this the first time.
Thanks.
When you export to Excel, leave Export data with formatting and layout unchecked. This will create a spreadsheet with raw data values in Lookup fields.
Export settings image

Use a another table's column's value as the name of a table in a join statement

First, I'll ask the question:
Is it possible to make a value's type 'dynamic' by creating different tables with different value types and use a simple join query to fetch the correct table based on the type specified in a column?
Here is the context:
I'm building a sort of page builder where I want the "modules" to be dynamic in the sense that I can create new modules without having to modify the database in any way.
I envision 4 entities:
A field, which represents a single value of a specific type, for example a text field or a checkbox;
An entry type, which represents a group of fields to be used for an entry. For example, Article = Title + Content + Image.
An entry, which is the content defined by the corresponding entry type.
A value, which contains the data for one field for one entry, defined by the field's value type.
For the 'value' entity, I was planning on using multiple tables for each "type of value". "value_text", "value_integer", "value_boolean", etc.
What I wanted to do (and I think it's an anti-pattern in relational database) was to grab a value in the fields table to select the proper "value" table.
Here is an image of the structure I envisioned:
(imgur) UML Diagram of DB
So I'm looking for a way to make a single query to fetch the correct value for each field of a specific entry (by ID).
This means I have to access the assigned entry_type, fetch all the fields related to that entry_type, then fetch the value of each of those fields from the value tables based on the column 'value_type' of the fields table.
If this is possible, how can I achieve this? If it's not possible, what would be the best way to tackle this problem:
Make a first query to retrieve the fields, then a query for each field to grab the correct value? This makes a lot of queries to get the values of a single entry...
Modify the structure of the database to a more efficient set of relations, taking into account everything is dynamic...
Get rid of the idea of using mutiple "value types" and stick to using a more common everything-is-serialized-text approach.
Also, as this is one of my first questions on StackOverflow, please let me know if I asked incorrectly and how I should formulate this in the future.
Thanks for all of you who even take the time to read this :)

use a multi-line variable array in a SSRS report

I have a large data set that holds the names and addresses of our customers. I need to allow the user to search this data set, however the user rarely has the key field necessary to make the search easy. They do however have three key values that will get them a reasonable subset to work with. They have the customer's last name, street and zip code. While this does not assure a single match, for the most part I should be in the less than 10 returns range. I am guessing most will only return 1 value.
I would like to have the user submit multiple lines of the three values and then return the appropriate values to user. I am looking at putting a new value in my table that has the three values concatenated, but I would have approximately 19 MM rows of data affected. I was wondering if there was some way with SSRS to submit an array variable with the three fields and then return multiple lines based on the values?
I am using SQL Server 2012 as the database.
Yes like BishNabo wrote, In your SQL just add the below structure with your field and table names. I've wrapped #var in wildcards to allow for partial values. This format requires all three to be submitted by the user.
Where tbl.fld_LName LIKE '%#LastName%' and tbl.fld_StreetName LIKE '%#Street%' and tbl.fld_ZipCode LIKE '%#Zip%'
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d6952bd0-af17-403f-8402-02759a9517fb/execute-tsql-on-ssrs-2012-with-3-parameters?forum=transactsql

MS Lightswitch Application, add temporary fields in data table

I have a requirement to add a temporary field in a data table. There are two types of fields you can add in data table. One is DATA fields which are actual fields, and Second is COMPUTED fields which have some limitations (not discussing here).
Let me explain my scenario, I have a table with fields Qty, Rate and Amount. Now I need to add one more field like InputRate which will be just a temporary field, do not have any role in the database. Why I need this is, I need to input rate let say in US Dollar, then then I have to convert this to my own currency say SAR. So I want that this temporary field will not save in database, but the actual one (the rate converted to SAR) will be stored.
We can do this easily in .Net windows Applications or Web Applications. But how can we do this in MS Lightswitch, because it will not allow to add fields on screen untill it is part of the data table. Even if you add a custom field (as I experiment) only on the screen, then it is going to repeat the same field's value for all rows (since my this table is DETAILS table). Means if my table has 5 rows, and in 6th row if I enter anything in custom field(with scope only on screen) then it is showing the same value of all other rows also, e.g. if I entered, then all other rows start also displaying the same value 10.
Any idea how to do this?

Update tables depending on parameter value MySQL

I'm having a bad day and can't think of an answer to this...
On my form I have a number of inputs, I'm updating some of them back to the database when the Save button is pressed. My issue I'm thinking is.
How can I match the Input field which I have stored as a parameter and check to see if this differs from what is already input or if the field is null then update with the parameter value, and another parameter value is x for example how can I update another table?
As an example my form has name, telephone, rented/owned, house type & notes. When I click the Save button these values will be pushed into a Procedure using IN parameters. I've updated fields in the table with the values which is great but, is there a way to check that the parameter value is different than what is in the table already and update this. As I don't want to update all the fields if they don't need to be. Also say rented/owned parameter was rented then is there a way to update a different table.
How is it possible to write in the procedure if parameter x = rented update table A else update table B?