Condition to supress a field in crystal report - sql

I need a clarification how to suppress rest of field if another any one is satisfied(except the satisfied field others should be suppressed.
Actually the scenario is there is a field table called mode of transport and in that three field should be there
sea
ocean
air
If sea is selected inside that four field should be displayed
bill of lading
shipping number
destination
bill to
So for all the above three there are such sub fields
If one field for ex sea is selected the relevent above four filed related to sea as given should be displayed and rest of fields for air and road should be supressed.
Kindly anyone help me with the condition to solve it sooner.

In the suppress section of the field you want to suppress you can put a condition like that:
{Command.MODE_OF_TRANSPORT} = 'sea'.

Related

How to Write a Variable for a Pie Chart with Multiple Fields in Qlik Sense

I am looking for some help in regards to writing a variable for a Pie Chart on my dashboard. I currently have the following variable for a KPI chart and this shows the latest weeks value but has the flexibility to change if a different week is selected.
=Sum({<week_date ={">=$(=Weekstart(max(week_date)))<=$(=Weekend(max(week_date)))"}>}total_calls)
Now for my pie chart, I want to show the different type of work that has been worked on during the week and this is through the 'source' column which has the following types. This will be my dimension(slice).
SOURCE
Calls
Email
Offline
The measure will show the number of 'touches' and is then displayed as a %. This works if I put the fields in, but I would like to write a variable so that it is dynamic but not sure how I do that.
Would appreciate any advice on how to move this forward.
UPDATES
I have the following values for the latest week (week ending) 21/02/2020:
Calls | 8,477
Email | 4,040
Offline | 9,052
and would like to show this in a Pie Chart. Currently I have managed to write the following definition:
=Sum({<[w_c.week_date] ={">=$(=Weekstart(max([w_c.week_date])))<=$(=Weekend(max([w_c.week_date])))"}>}[w_c.touches])
but I get a total instead of the individual sums for the Sources even though I have selected the SOURCE as the DIMENSION.
SOURCE | $(vVariable)
Calls | 21,569
Email | 21, 569
Offline | 21,569
Any ideas on how I can fix this?
I have added my table view as well as how I am able to get the figures manually if I select the source and week_date column as the dimension and the touches as the measure. If I filter for the latest week it shows me the volumes I want, but I would like this to work dynamically through the use of a variable. I have attached an image showing this, numbers will be different to the above as these have been updated.
I have managed to fix this by removing the "=" from my expression and this gave me the correct individual figures.
=Sum({<[w_c.week_date] =
to
Sum({<[w_c.week_date] = ...

Loop through records and generate time stamp

My report tracks all high level incidents. As part of the report I want to be able to pull through if an hourly chase has been taken on the incident. The update would be stored in a table called ActionTBL in a field called Action_Type and incident is stored in the IncidentTBL.
I want to be able to loop through the field Action_Type and pull out all the actions which equal "Chase" - then record the time when the action was taken. The report would be something like:
Chase 1: 12:00
Chase 2: 13:00
Chase 3: 15:00
The report would then highlight that Chase 3 was taken an hour later than it should have been. How can I do this in Crystal Reports, if I even can?
It's difficult to give you the best advice since we don't know what your report looks like, or how it's structured. Since we don't know that, the most likely answer is to use a Subreport. This should work without you having to restructure your report.
You'll want to place the subreport in your report footer, and suppress the Headers and Footers inside said subreport.
Assuming you've already linked up your tables correctly, all you would have to do is reuse your original record selection formula to have an additional clause where Action_Type = "Chase" and group by date_actioned. Reuse the same parameters as your parent report and pass them in. This should generate the list you're looking for.
if you look only for the records with chase then the solution that I would think of is to use Record Selection Formula to retrive only records with chase
Go to Report --> Select Expert --> Record and write below code:
Action_Type= "Chase"
This will omit all other records and retrive only records with Chase and place the Action_Type in details and then use field that has time stored

Database Design: Line Items & Additional Items

I am looking for a solution or to be told it simply is not possible/good practice.
I currently have a database whereby I can create new orders and select from a lookup table of products that I offer. This works great for the most part but i would also like to be able to add random miscellaneous items to the order. For instance one invoice may read "End of Tenancy Clean" and the listed product but then have also an entry for "2x Lightbulb" or something to that effect.
I have tried creating another lookup table for these items but the problem is i don't want to have to pre-define every conceivable item before I can make orders. I would much prefer to be able to simply type in the Item and price when it is needed.
Is there any database design or workaround that can achieve this? Any help is greatly appreciated. FYI I am using Lightswitch 2012 if that helps.
One option I've seen in the past is a record in your normal items table labeled something like "Additional Service", and the application code will recognize this item and also require you to enter or edit a description to print with the invoice.
In the ERP system which we have at work, there is a flag in the parts table which allows one to change the description of the part in orders; in other words, one lists the part number in the order and then changes the description. This one off description is stored in a special table (called NONSTANDARD) which basically has two fields - an id field and the description. There is a field in the 'orderlines' table which stores the id of the record in the special table. Normally the value of this field will be 0, which means that the normal description of the part be displayed, but if it's greater than 0, then the description is taken from the appropriate row in the nonstandard table.
You mean something like this?
(only key attributes included, for brevity)

Duplicate fields because of my SQL

IF ({PICT_Picture.Job_Print} = TRUE) THEN
IF({PICT_Picture.Process_Name}=["SMALL MOULDING","LARGE MOULDING"]) THEN
"YES"
ELSE
"NO"
ELSE
"NO"
PICT_Picture.Job_Print - is a tick box that allows me to print a picture on a production route card.
PICT_Picture.Process_Name - is a drop down box that allows me to select what process a picture is for.
The problem I am having is if I have multiple images attached to a product that is on a generated report, duplicated rows will be created for each picture I have attached regardless of being under LARGE MOULDING, SMALL MOULDING, INSPECTION, etc.
I have very little knowledge about crystal reports and SQL, I am looking for a line of code that will only generate one line per product regardless of how many pictures are attached.
If you require any additional information please say and I will try and attach it as soon as possible.
Thanks
~EDIT
{ORDE_Goods.Job_Number}=previous({ORDE_Goods.Job_Number})
I put this in suppress no drill-down, It worked right away.
It got rid of all of the duplicate jobs.
The best way to achieve this in Crystal reports is to create a group. Group on your "primary key" then move all your fields from the details section of the report canvas into the group footer section and suppress the details section. Further explanation:
Before- duplicating records:
After (detail section suppressed, group added on order number- we want 1 record per order number):
L
If you're executing SELECT query can you not add DISTINCT to select one line per product.
For example,
SELECT DISTINCT Product, ... FROM YourTable

Complex Names with Authorize.net AIM

How do the rest of you handle complex names when submitting a transaction to Authorize.net using AIM?
Nearly every ecommerce application on the planet asks the user to fill in the "Name as it appears on your credit card". For some odd reason, Authorize.net wants you to submit x_First_Name and x_Last_Name however.
This is fine when you're dealing with Mary Jones or Jack Smith. It becomes a real hassle when you've got Margret A. Jones-Robinson and H. William Robert Van Horn, Sr. though.
Is there a best practice here?
First & Middle names in the x_First_Name field?
Last Name, Hyphenated Name and/or Suffix in the x_Last_Name field?
Has anyone developed a routine to parse names accordingly?
Thanks!
Have two fields on your payment form. One for their first name and one for their last name. However the customer chooses to complete the form is how you should submit it (and save it in your database if you choose to do so). FYI, the name on the credit card is not used in the processing of the credit card so you do not have to transmit it to Authorize.Net to process the transaction. You should do it anyway as it helps to keep your records accurate and complete which is handy when doing audits of your transaction history.
You should generally try to avoid using one field for names as it opens up the possibility for people to enter bad information like, "The Smith Family" or "Barabara and Steve". By having two clearly delimited fields you greatly reduce the occurrence of this.
You should use 2 fields on your payment section. First name and last name.
The name on the credit card is actually used by certain cards for some services, so if you signed up for AVS and fraud detection they will use that name and provide feedback as to if its a match or not.
Alternatively, and what we have done in the past is ask the customer for:
-prefix
-first name
-middle initial
-last name
-suffix
This allows the customer to feel in control and you avoid them filling garbage in the 2 main fields (first name, last name). Authorize.net and other merchant service providers dont care for then other fields and you may choose not to either, it is just a way to keep the data "cleaner".