VFP - Control report from form - crystal-reports

iam using VFP 9.0...Iam making an invoice report, what i want to know is how to change the contents of the report by changing lets say a combo box in a form. or be able to use select and where clause in the report...any help would be appreciated :)
EDITED FOR CLARIFICATION (per comments instead of direct add into question)
+-----------------+ +-------------------------+
| Contract Form | | Invoice Form |
| | | |
| | | radioCustomer |
| btnInvoiceForm -------> | comboCustomersList |
+-----------------+ | radioContract |
| comboContractsList |
| |
| btnPreviewReport |
+-------------------------+
If I click on the Preview Invoice button, show all records from contract table where customer id (FK) is = to the id picked from the combo box.
If I picked contract from the radio buttons, the contract combo box would work, showing a list of contract id(s), running the report then would show you the record from the contract table where contract id = the id picked from the combo box...

I've edited the message to hopefully better understand your layout of the form(s) with respective radio button combobox controls respectively enabled/disabled. I think you'll need to draw up two distinct reports no matter what showing respective content, then call each one based on the radio button setting... Such as in the "btnPreviewReport" object CLICK event... I've roughed-in on the sample...
if not empty( Thisform.radioControl.radioCustomer.Value )
*/ Customer radio button was selected
xCustomerID = comboCustomersList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleCustomerData
*/ Run the report
report form YourCustomerReport preview
else
*/ Contract radio button was selected
*/ Customer radio button was selected
xContractID = comboContractsList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleContractData
*/ Run the report
report form YourContractReport preview
endif
Again, I tried the form as best from your description.
EDIT -- second comment clarification...
The nice thing about reports in VFP is they do not pre-require any hard DBF() in the data environment. However, it would be good to have your data fields set to an Alias.Field reference you are EXPECTING to have. So, if your querying of the data for the Customer report should always have the same expected alias result...
ex:
// pre-close in case the alias we want was already left open previously
use in select( "C_CustomerResults" )
select c1.*;
from YourCustomerTable c1;
where c1.ID = SomeChosenID;
into cursor C_CustomerResults readwrite
Then, in your report, have all your fields to something like
C_CustomerResults.FirstName
C_CustomerResults.LastName
C_CustomerResults.OtherField
This example uses an otherwise long alias name but just for clarification of handling.
I would do a similar for your "contract" results alias. As long as that alias is in use, the report will run against whatever is the current table in use. Nothing fancy, no other prep, no data environment settings needed in the report...
By pre-querying a sample of the data you would have in the report can help you in "roughing" the layout of your report. Then, finish your form to run the query and show the report and you're done.
EDIT -- revised comment follow-up again
Yes... for your customer invoice with multiple lines, same thing... however your report has a header band for things you want to only show once at the top of the page, and a detail band where you would want to show content for your "each line item" of the invoice, and a report footer to show any totals. Depending on complexity, you can add additional "Data Groups" in the report, but start with this now. It sounds like you need to get your feet wet with something working first before you expand on it.
If VFP is your development platform, another website that has dedicated experts in VFP all the time is at www.UniversalThread.com. They also support other forums, but in VFP, they'll get 100+ questions thrown at it a day...

Related

Lookup in LibreOffice Calc to match partial string of the search criterion

I'm putting my banking information in a LibreOffice Calc spreadsheet.
I have columns as follows, that I imported from my bank account:
Date | USD | Description | Category
----------+-------+---------------------------------------------+----------
2/28/2019 | 44.00 | POS 0123 2345 123456 FRED-MEYER #02 | groceries
2/27/2019 | 2.50 | PANDA EXPRESS #123 TIGARD OR - 123546789012 | lunch
These descriptions are very unpredictable, they're whatever merchants want them to be, but they can tell me useful information about what I spent my money on. I've used this information to manually enter the categories. But I'm looking to automate this for common things.
So, I created a separate sheet with lookup values, like so:
Expression | Category
-----------+----------
FRED-MEYER | groceries
PANDA | lunch
I am looking for a formula in the "Category" column of the first sheet to automatically determine categories, based on the lookup table in the second sheet. (Obviously I don't plan for the lookup table to be exhaustive, but whatever I don't put in there, I can enter in the first sheet manually, thus overwriting the formulas.)
I had this working fine in Excel using a nifty construct of SEARCH and MATCH. (I don't even understand it anymore and I don't have Excel to check.) But since I'm now a Linux user, I'm trying to use LibreOffice, and I've not been able to make this work with formulas. I tried SEARCH, MATCH, LOOKUP, VLOOKUP, FIND, with and without regexes and with different options on/off. But no success so far.
I think this is very similar to this question, though it was only answered for Excel (I'm using Calc).

Access Update a table row based on a combo box selection

I have a table I would like to edit based on a combo box selection in a form.
For example, let's say I have a table that has the following fields:
Computer Name | Location | Number of Updates installed | etc.
What I have done is created a form based on this table. It includes a combo box to select the computer name that's being updated. What I would like to do is fill out the rows based on the computer selected in the combo box.
What's the best way to do this?

how to filter data on different sheets based on clicks on Tableau

How to filter data on different worksheets based on clicks in Tableau. For example:
Sheet 1 - The partition looks like this:
+------+-------+-----+
| Name | Month | ... |
+------+-------+-----+
| A | Jan | ... |
| B | Jan | ... |
| C | Feb | ... |
| D | Mar | ... |
| ... | ... | ... |
+------+-------+-----+
Sheet 2 - The partition includes Month.
When I click on Jan on Sheet 1, can Tableau filter Jan on Sheet 2?
I tried including an URL and making the filter universal to all sheets but filter doesn't work "on click" does it?
Filter actions are an essential and fundamental tool in Tableau, and you're going to want to master them fast, so I'd recommend hitting up this help page for a good overview of how they work.
Go to Actions… (if you're on a dashboard, you can access this menu from Dashboard, or access the same menu from Worksheet if you're working from a worksheet). Select Add Action > and choose Filter. Your source sheet (the sheet that will control the filter) will be Sheet 1. Your target sheet (the sheet that will be filtered) will be Sheet 2. Hit Select under Run action on:.
At the bottom of the menu, under Target Filters, choose Selected Fields. This will allow you to filter only the specific fields you define in this menu. Hit Add Filter... and choose Month for the source and the target. You've now created a filter from Sheet 1 to Sheet 2 that will only filter based on Month.
It's possible that you don't need to be that specific and can actually filter all fields. There's a quick way to do that if the sheets are in a dashboard. Click the dropdown menu at the top right of Sheet 1 in the dashboard and select Use as Filter. This will automagically create a filter using all fields from that sheet to all other sheets on the dashboard. If you need to tweak it, you can go to that same Actions... menu we just discussed, select the filter from the list, and change any of the things we discussed above from there.
A filter can be used across multiple worksheets. On the filter triangle, select "Apply to worksheets" --> "Selected Worksheet". By default it will show only the worksheets in the current dashboard. At the bottom, check box show all worksheets. You can then select any sheet you want to apply the filter to.

SSRS Dynamically setting table position/location

I see in Report Builder / design mode, there is a Position and Location property that allows you to set how far from the top or left the table should appear.
My question is, is there a way to set 2 or more tables in the same location (ie top of the page 0 from top, 0 from left) without having them stacked on top of each other in design mode / report builder?
Is there a way to dynamically set that position property?
For instance, here is a sketch of a report in report builder:
top of page
---------------------------
Table 1 (hide) |
|
|
|
Table 2 (show at top) |
|
|
|
|
|
|
|
---------------------------
bottom of page
The location properties for Tablix members are not expression based. However, you can show/hide objects within a report based on a parameter, and this can affect the position of other report items. A simple example:
A report with a Header, two Tablix members and one parameter, HideTable:
The Hidden property for the top Tablix is set to =Parameters!HideTable.Value, i.e. the parameter toggles whether it's displayed. With this setup and layout, SSRS automatically shifts the second Tablix to the top of the report Body when the first Tablix is hidden. See below:
So it's not quite a dynamic location, but by using other features you can achieve the same functionality as above.
In Addition to Answer mentioned by Ian Preston, If Table 1 Does not have data, then we need write as follows:
=Parameters!HideTable.Value or IIF(countrows("Tablix1")<1,True,False)
Here, Tablix1 is First tablix name
So that header would not appear in case of data unavailability in Table1

Crystal Reports Conditional Details Section

I have a report that joins multiple tables. One possibility for this join is that no rows are returned under part of the selections criteria. Sort of.
I have 3 groups: Movie Rental Place, Type of Movie, Rented / Not Rented / No Interest to Rent.
So an example could be:
Blockbuster | Comedy | Rented: List rented movies.
Blockbuster | Comedy | Not Rented: List movies not rented.
Blockbuster | Comedy | No Interest to Rent: List movies not interested in renting.
Now, I do not want to suppress a section if it is empty, I want to print something else in the Details section of CR. Is there a way to do this?
I am using CR 11.5.
Thanks
Go to Section Expert and check the "Suppress blank section" option. Add a new section below it (for the static message) and add a suppress formula to that section that uses some isnull check on whichever column indicates "no data".
Before, when I was attempting to create a custom formula for the Details section, I was testing on NULL values, when the report was setup to give default values for NULL values. Once I removed that, things worked as intended.
Thanks