Is it possible to run multiple functions in one request - sendgrid

Newbie here with limited to no history with coding.
Attempting to build an email template and I want to know if it is possible to run multiple function in one request? I am providing some test data below to try and better explain what is needed
Custom Field 1 - Score_A - Value can be between 1 and 10 This will vary based on the customer being emailed)
Custom Field 2 - Score_B - Value can be between 1 and 10
Custom Field 3 - Score_C - Value can be between 1 and 10
Custom Field 4 - Score_D - Value can be between 1 and 10
I need the code to search across all four custom fields and if any of the values of these custom fields is more than 5 I want to the outcome to read "Good", if any of the vales of the custom field are below 5 I want the outcome to read "Bad". I do not want out outcome for each custom field, I just need 1 outcome for each email.
e.g. if
Score_A=6
Score_B=9
Score_C=10
Score_D=8
The outcome in the email should read "Good"
But if
Score_A=2
Score_B=9
Score_C=10
Score_D=8
The outcome should read "Bad"

Related

Crystal Report number of pages according to field value

My first question, so please excuse any mistakes.
We have internal ID numbers for product that we are selling, composed of: [SalesOrder_Num]/[Num].
For each Id No. we offer a Test Certificate to the client. Test Certificate defines the suitable age of product, along with its technical specification. Multiple items (20-30) on sales order can have same technical specification, but different ID number. ID Number also becomes Certificate Number.
We need to print/pdf these test certificates using Crystal Reports. There is a custom made Certificate Window on which technical specs are manually typed, along with sales order number. We also fill in number of Certificates (= [Num]).
What we now want is: Print [Num] of records/PDF with Certificate Number incrementally increasing on each PDF - [SalesOrder_Num]/1, [SalesOrder_Num]/2, ... ... ,[SalesOrder_Num]/[Num-1], [SalesOrder_Num]/[Num].
How is it possible?
Best Regards,
K
Create a REPEATER table with a single column (How_Many) that looks like this:
How_Many
1
2
3
4
5
6
etc..
Now, in your report, add the Repeater Table and add a join condition of:
Order.quantity >= Repeater.How_Many
If the ">=" join option is not available, remove the join to the REPEATER table and create this condition in the Record Selection condition:
{Order.quantity} >= {Repeater.How_Many}
This would cause each order to be duplicated as many times as the value of {Order.quantity}.
If you are restricted to using an equal join, you can also modify the repeater table to include N records for each quantity N:
1
2
2
3
3
3
...
This would cause each order to be duplicated as many times as the value of {Order.quantity}.
If you need to print "N of M" modify the repeater table to look like this:
N M
1 1
2 1
2 2
3 1
3 2
3 3
and use an equal join to the N column.
An alternative solution is to use a 3rd-party Crystal tool. At least one of the 3rd-party Crystal Reports viewers listed here provides the functionality you are seeking (without needing to add a Repeater table to your database).

How to combine 5 columns into 1 filter in Tableau?

My (simplified) data structure is as follows:
I have flagged whether my users have performed a certain action in the last 7 days, 14 days, 1 month, 6 months, and 1 year (1 means the user has performed the action and 0 means he has not). I would like to create a drop-down filter in Tableau where I would be able to filter out the users who have performed the action in the last 7 days, 14 days, 1 month, 6 months, and 1 year. I will have a total number of users at the top of my dashboard and an "action date" filter. Does anyone know how I can achieve this kind of filter in Tableau? I believe I have to create a parameter but I am not sure how to combine these 5 columns into 1 filter.
Any help is appreciated!
The easiest approach to explain is to create a parameter that allows the user to select exactly one value from a prescribed list of strings, such as "7 days", "14 days"... etc. You may also want a few other choices like "Start of Time", or "All users". Whatever options you like.
Then create a (boolean) calculated field that denotes whether the current data record should be included based on the current parameter value. Something like
if [My Filter Param] = "7 Days" then
[7 Days] = 1
elseif [My Filter Param] = "14 Days" then
[14 Days] = 1
...
else // last one
[My Filter Param] = "Start of Time"
end
Then put your calculated field on the filter shelf, choose True as the filter value, apply to whatever worksheets or data sources matter, and of course display your parameter control.
This is a pretty general technique, combine a parameter (for asking the user to make a choice) with a boolean calculated field (to apply the users choice) and the filter or other shelf for applying that calculation to a visualization. Works for all kinds of problems.
If your data sets are large or slow, you can optimize performance in a few ways. Say by using boolean fields in your data instead of integers, and by using integer valued parameters instead of strings so you can use a fast case statement to replace all the string comparisons (although Tableau can optimize some of those comparisons away) If you do use an integer parameter, you can still define the choices to display meaningful strings in the parameter control. See the edit parameter dialog.
Finally, you could consider making your analysis and viz a little more flexible by adjusting your pre-processing to produce data with just two columns -- User and Date_of_Last_Key_Action . Then your users could just use the built-in date filter controls in Tableau to view based on any time range, .e.g, the last 13.5 days if they wanted. You wouldn't need a parameter or calculated field in that case.
You can also re-shape your data. Do like the screenshot GIF

Get the distinct count of applications used by users who used application A in Tableau

I have a data set of users and the applications they used. For each application, I want to compute the total number of users who used only this application, who used this application + another application, +2 other applications,... At the end I need to get a treemap with where each square represents the total number of users who used only the application, the application + 1 application, + 2 applications,......and also compute the overlap percentage, that is how many users used only this application vs how many users used this application with another application. I could compute these metrics if I don't add the application constraint, that is compute the number of users who used one application, 2 applications, 3 applications, ..... and the overlap percentage was the percentage of users who used more than one application.
To do so,
I created a calculated field to count the total number of applications per user
Then I used this field to create bins, which gave me the total number of users who used 1 app, 2 apps, ..... N apps
I then ended up creating a treemap with those bins where the size of each square is the countD(users).
How to do the same but instead of only having (All) applications, be able to do it with only one application and their companion applications. I need an application selector, where each time I change the application, the treemap changes.
As you have not given sample data, I am proposing a solution assuming -
No rows are duplicate i.e. every user is associated with any unique application not more than once.
application types may not vary more than 15-20 (in that situation the solution may not work given the calculation range of tableau)
I have taken a sample data as follows-
Step-1 Create calculated field (CF) named as CF as -
// map every application with a number
CASE [Apl id]
WHEN 'apl1' THEN 1
WHEN 'apl2' THEN 2
WHEN 'apl3' THEN 3
WHEN 'apl4' THEN 4
WHEN 'apl5' THEN 5
END
You may add as many values as you have (all unique values of apl)
Step-2 add another CF CF1 as
// binary representation of each application used
{FIXED [User id]: sum(10^([CF]-1))}
Step-3 Create a parameter as
Step-4 add another CF CF2 as
// checking which user uses selected application mandatorily
If
LEFT(RIGHT(RIGHT('00000'+STR([CF1]),5), [Parameter 1]),1) = '1'
then 'Y' else 'N' end
Now you may build your view as shown below
Selecting parameter value will filter out those records where user is at least associated with selected value. Distinct count value will give you count of total applications used by these users. Now you can proceed to build your treemap. Please tell if any other help/explanation in the solution is required.
Note-1. This solution is proposed on binary logic (and hence the restriction). If you will see sum(CF1) values will give you a binary representation of applications used by that user where rightmost placeholder denotes that user is using apl1 yes (1) or not (0); and similarly onwards right to left.
Note-2: While calculating CF2 I have padded the CF1 values with leading zeros at most 5. This you have to change according to total count of your applications.

Microsoft Access - I want my mainform to create X records in subform base on fields automatically

I been putting a lot of thought into the logic behind this, and I can't seem to figure out the best way to handle this problem.
1 - Afterinsert
2 - unbound fields + button to insert X times
3 - I am open for suggestions
The form
The relationship
I was debating on using AfterInsert to handle everything. Since NoOfBoxes will decide the amount of records and I would only need to duplicate the value of MergeNo and isCommission to the subform. But the problem is, I need to also auto fill the item, which made me think of solutions number 2.
The reasoning behind going with number 2 is; my receive report header doesn't contains the item information and since a subform can only have 1 type of item but multiple of them. I was hitting toward number 2.
Solution number 2 would be multiple unbound fields which pulled the information into a combo box, or enter the information needed and hit a button which will then transfer all that data to the subform and create the correct amount of records.
unbound fields = itemcode, mergeNo, isCommission, and NoOfBoxes.
I think you need a Numbers table with integers from 1 or 0 to an appropriate number, you can then say something like:
INSERT INTO ATable ( MergeNo, IsCommission )
SELECT [Forms]![aForm]![MergeNo] AS MergeNo,
[Forms]![aForm]![IsCommission ] AS IsCommission
FROM Numbers
WHERE Numbers.Number<=[Forms]![aForm]![NoOfBoxes]
Do not forget that if the numbers table starts from 0, it is less than, not less than or equal to.

Variable Number of Plots in an MS Access Chart

I have the following problem with MS Access:
Suppose I have a list of companies with monthly performance values. I can view the performance of a single company in a chart by hooking the chart into a query with a Month column and a Performance column.
Now suppose I want to display a chart for N companies. I could theoretically do this if I were to generate a query with a Month column and N Performance columns (one for each company). Is there any way to create a query with a variable column count like this? I have a SQL backend that I can use if necessary, and I'm fine with putting together any VBA code necessary to support it. The only impediment I'm seeing is that I'm stuck using MS Access, which I am not very familiar with.
So here are my main questions:
Is this even possible?
How would I go about tackling this issue? I'm trying to minimize research time, so it would be great if I could just get pointed in the right direction.
Thanks!
With this table:
company pmonth performance
1 1 10
2 1 8
3 1 15
1 2 15
2 2 5
3 2 25
1 3 5
2 3 4
3 3 20
I create this query:
SELECT p.company, p.pmonth, p.performance
FROM MonthlyPerformance AS p;
Then change the query to PivotChart View and drag company field to "Drop Series Fields Here", drag pmonth to "Drop Category Fields Here", and drag performance field to "Drop Data Fields Here".
If you prefer, you can create a form using the same query SQL as its data source, then set the form's Default View to PivotChart, and set up the chart the same way as I did for PivotChart view on the query.
If that's not what you want, give us some more information about the type of chart you want and the context in which you will display it.