Rename Fields or Tables in Queries (Alias)

schizek

New Member
Is there a way to assign a field as a different variable name inside the query? I need to pull the same column based on different parameters from the same table. In SQL I would use an alias like "SELECT alias1.field1 FROM table1 AS alias1".

Is there any way to do that or something similar in Progress 10?
 
You have to define a buffer:
e.g.
Code:
define buffer bufcust for customer.
 
find bufcust where <condtion>.
 
find customer where <othercondition> .
 
if bufcust.field1 = customer.field1 then....

or in a for each:
Code:
defne buffer bufcust for customer.
for each customer where <somecondition>,
    each bufcust where bufcust.field1 = customer.field1:
 
/*    do something interesting here... */
 
end.

hth,

Casper
 
What do you think you will accomplish by this? You can put any label you want on a field when you display it, so what does it matter what the internal name is? I suspect your need is for something other than simply moving data into a buffer where a field has a different name than the original.
 
I need to pull the same column (ex: table1.field1) from a table based on different criteria in nested queries. I am having a problem because when I run the second query I can't access the value of table1.field1 because there is already a table1.field1 in the first query.
 
Is this SQL or ABL?

One runs into the need for aliases in SQL rather easily, but I don't think I have ever seen the need in an ABL query.
 
This is ABL.

The buffer solution did work for me. However, perhaps there is a better way to do it. I am writing a report in Webspeed to display a list of all orders with skus that are allocated at a particular warehouse. To get the actual allocated quantity for each sku I need to muliply the order line quantity by the conversion factor for the Unit of Measure for that order line. Then I need to divide by the conversion factor for the base Unit of Measure for that sku. To do this I will need to make 2 calls to our Unit of Measure table to get the two conversion factors.
 
OK, when accessing the same table, e.g., in your case to get a base component, then buffers are very much the way to go. Indeed, there are those who would suggest always accessing a DB table via a buffer since that tends to make the scope clearer, but that is clearly not necessary. But, there are many problems where one needs two or more buffers on the same table; bill of materials being a classic.

I think I got lead off in the wrong direction by the emphasis on field in your original post, even though the subject says table or field.
 
For other it may be simple, but i feel i need to know it as a progress developer

how do i know my data base SQL or ABL?

Progress database is SQL or ABL ??
 
A Progress, or more currently, an OpenEdge database is what it is, just like Oracle or any other brand name. SQL and ABL are access methods, not storage techniques. The primary access method for OpenEdge databases is ABL, but SQL is also supported. Moreover, Progress DataServer products support accessing Oracle, SQL Server and other databases with ABL, even though they are normally accessed by SQL in their most usual environments.
 
Back
Top