How to write Query in progress openedge 11.6 - progress-4gl

How to write query in progress?
How to display all data from Table in Sports database.
Provide me some link for query practice in progress at beginner level.

If OpenEdge gives error
**FILL-IN Comments will not fit in FRAME in PROGRAM . (4028)
then it means, that default frame for display is not big enough.
Width of default frame is 80, but in SportsDB.Customer.Comments is defined with format "x(80)". And it means, that you must handle Comments in this way, that it fits to frame.
One of possible solutions is to use default frame, but handle Comments field in different way:
FOR EACH customer:
DISPLAY Customer EXCEPT Customer.Comments WITH SIDE-LABELS.
DISPLAY Customer.Comments format "x(50)".
END.
Another possible solution can be to use your own frame
DEFINE FRAME demo WITH SIZE 135 by 24.
FOR EACH customer:
DISPLAY customer WITH FRAME demo SIDE-LABELS.
END.

DEFINE QUERY q1 for customer scrolling.
OPEN QUERY q1 for each customer where state='TX'.
Get first q1.
Display name.
Do while NOT QUERY-OFF-END('q1'):
Get next q1.
If AVAILABLE customer then do:
Display name.
End.
Display num-results('q1') label "Number of records".
End.
Reposition q1 (to/forwards/backwards) 5.
get next q1.
display name.
CLOSE QUERY q1.
Multitables
Define query q1 for customer, order, orderline.
Open query q1 for each customer where state='TX',~
each order of customer,~
each orderline of order.
…

The answer above is perfect. But I'll just add the simpler way, because I'm getting a vibe that OP doesn't know much, so it's possible they didn't even formulate the question correctly. So here's the simplest way to display all data from the customer table in sports DB:
FOR EACH customer:
DISPLAY customer with side-labels.
END.
Just look up OpenEdge tutorial and you should be able to find something to teach you the basics. Good luck!

Related

VBA to drill down specific data on Pivot Table

I am trying to get code so that by pressing a button, users can download certain source data from the Pivot Table. I have a PT set up that is controlled by slicers, so the PT size changes depending on what is selected (customer, date).
I have tried to record a macro, but when I double click the data I want to see, all the macro records is the cell reference, so this wont work if a different customer is selected.
I have attached some images which I hope helps demonstrate what I am trying to achieve.
Is there code that can do this? If so, can I get an example so that I can try to make it fit my working model?
Thank you
Raw data view
Pivot Table
Drill Down 1 e.g.
Drill down 2 e.g.

How to get the sum directly with one number?

I'm a beginner for tableau. I want to get the direct numbers for each row, but i get the number which are separate, how can i achieve this?
I've tried the sentence like:count("Implemented"), but I don't get the result I want.
For example, for the 1st row I want 3 10 10
not 111 10 112111111
Here is worksheet.
My code:
EDIT :
here is the photo for implementation opportunities
As you can see, the status is related to the date, I think maybe it causes the records which are counted 1by1.
Now the situation is that: i create the code which is related to the date, if i remove this from mark, it will cause the problem (the code is related to the date), but if i leave it, the system will always count it one by one. My code is not perfect but i can't find another one which can replace it.....
EDIT 2:
in short,what i want is the sum of the remaining opportunity:10
capture
Remove DAY from Mark shelf. That detail is producing those separations.
Attaching a workbook with numbers similar to (but not exact due to proprietary issues) is almost always advised. You will get the right answer a lot sooner than just screenshots.
In any case, it seems as if the measure portion of the visualization is properly being summed by the date. Try selecting the measure, and manually selecting "sum" from the menu drop down. Here is a link for more detail.
Secondly, you can play around with table calculations. Click this link and read up on option 3.

Tableau, color-coded bar chart not working

Public workbook here. Source is Excel file.
I was able to create ordered bar chart based on (1) Location (2) Product
When I drag Above Three into Color, the graph is incorrect, how to troubleshoot?
Update
I made change such that Calculation computers based on Product, Above Three for each Location, at level Product.
However, Morton's still shows error.
The order in Mortons should descend, based on number of records, i.e.
Dark Chocolate
Beer
Toffee
Coffee
Fries
Rest of the Locations are correct, but only Mortons gives out-of-order products
Update2
Calculated Field Calculation3 = Index()
And I filter Calculation3 for 1 to 3, to display top 3 products
If I remove Calculation3 from filter, it gives correct order but it give ALL products, not the top three popular products (per Location).
I updated workbook to illustrate this. Please advise.
I don't know the purpose of the Index() field but that is creating your issue. Remove it from rows and the color appears to work the way you want it.
I hope this is what you are looking for
I have also published the file at the below address. You can take a view on that.
Tableau Wokbook
I achieved it by the following methods.
I changed the Calculation 3 field from Index() to RANK(SUM(NUMBER OF RECORDS)).
The calculation 3 was kept in between Location and period then edited the table calculation of calculation 3 by keeping the Addressing of the edit table calculation, having only the location and product as shown below and then Set the restarting every to Product.
You can check the workbook for more information

ListView: instantly updating and time comparision

I have to work on an application in which we are getting list of orders(with all details and display_time) and we have to show them in list view, but the condition is we have to show particular order on their exact display_time.
For example below are some orders with display time:
order_id: 101 |
display_time (hh:mm:ss): 09:10:00
order_id: 102 |
display_time (hh:mm:ss): 09:30:00
Then the requirement is:
We have to show the orders on list on exact their display time.
All order should come instantly as they entered in database.
Edit
The first thing that I need is:
To get the order from database (SQL Server) instantly without hitting
any API. Like push notification.
Then the second need is:
To compare the device's time and order's display_time and if its matched then make visible the order in ListView. I have to do this for each order i think.
I don't know how can I do this.
So please suggest how can we do the above task.
I hope I understand correctly. Mainly you want the list of items to be in the order of time from earliest to latest.
Here is one algorithm and it could be enhanced.
Allocate 100 (arbitrary) items/rows in the Listview.
If you only have 2 items or orders initially, make the other 98 rows not visible (state).
If a new order is entered, add the new order into one of the non-visible rows. And make it visible of course.
The issue in this case, you may have to reorder the items above the new order. However this is only a manipulation of text in your rows. A data structure is necessary to support this.
I claim this algorithm is fast. I think this is a good start.

Crystal Report show history based only on two field changes

I’m trying to write a report using the history_table.
I want to know how would I only bring the records only to show a history if only two fields have changed ex (ss.dem1) and (ss.dem2) in the table
If anything else changes like phone or address that are in the table as well to not bring that up or suppress it in the report. I want to see the data only those 2 fields have changed and every time it has changed as a history.
This would be an example of what I'm trying to accomplish.
I also used tried to use a suppression formula but only gave me the last record and not show me the example like I would of like above
not onlastrecord and next(PATID)=PATID and next(ssdem1)=ssdem1
or
not onlastrecord and next(PATID)=PATID and next(ssdem2)=ssdem2
Any help is greatly appreciated.
On the DB side you could do a self-join and only keep the records where one of those items you're interested in has changed, ex:
select WHATEVER
from HISTORY H1, HISTORY H2
where H1.PAT_ID=H2.PAT_ID
and (H1.DEM1 <> H2.DEM1
or H1.DEM2 <> H2.DEM2
etc...)
Or, you could order the report by PAT_ID, then by the date/time of the edit and then suppress the rows where nothing changes, which sounds like what you were trying to do. If you post the exact suppression formula I might be able to see where you were going wrong. Should be something like:
not(onfirstrecord) or
({TABLE.PAT_ID}=previous({TABLE.PAT_ID})
and {TABLE.DEM1}=previous({TABLE.DEM1}) //check all fields you're concerned with for equality
and {TABLE.DEM2=previous({TABLE.DEM2})
and etc...)