473,899 Members | 3,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display of text fields

[Sorry for possible pluri-repeat: I'm not putting up very well with the
technicalities of ... your Majordomo ... -:)]

Hi all!

[Using PG 7.2.1 on Debian/Woody, k. 2.2.22]

After a very long struggle I finally succeded in transferring my old
*.dbf file and the relating *.dbt (alias memo fields) to a pg table.
For the time being I put the memo field in a separate table having two
fields only (i.e.: n_memo integer, memo text) which can be related to
the main table in a view.

Now, the first problem is that when I do a select * from this table it
will scroll up to the end, no matter whether \x or \t or \pset pager are
set or not! [For information: if I put the text fields in the main
ex.dbf table - which has more columns - or do a select from a view
connecting the 2 tables the page control works fine].

Second problem: the display of each text field looks like this:

# ---------- quote ---------
-[ RECORD 1 ]--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
col1 | Anatomical Diagrams for the use of the Art Students Arranged
with analytical Notes and drawn out by James M. Dunlop, A.R.C.A.,
...... [ cut ] ....

[Example taken from a single column table, but the result is the same
for the 2 cols table]

# ----------- unquote --------

My questions are then:

1. Is there a way to avoid displaying the '---------' lines, apart from
the \a flag ?
2. In case I put the memos in the main table, would it be possible to
control someway the display of memo-text fields? [Only some of the
records have a memo, and a referring col set to 'T', so I'm looking
for a selective instruction, such as: if ctl_memo='T' display memo,
else, display the other cols only].
3. Does the pager work better on version 7.4.3?

I realize that the version (7.2.1) I'm working with is old as compared
to the running 8.0, so your help will be particularly appreciated.
Regards,
Ennio.
--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why to use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (used to say Henry Miller) ]

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05
13 3714

On Fri, 10 Sep 2004, Ennio-Sr wrote:
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 07:10]:
On Fri, 10 Sep 2004, Ennio-Sr wrote:
I slightly modified your queries and the result gets nearer my goals,
but ...
Here is what I tried:
[ ... ]
As an explanation of the duplicate rows:

FROM bib_lt t0, bibbt t1 with no WHERE condition that constrains the join
[ ... ]
If you're not using any other fields from t1, I would wonder if something
like:

SELECT t0.n_prog, ..., t0.scheda_ltr, coalesce(t1.not e, 'n/a') as note
FROM bib_lt t0 left outer join t1 on (t0.scheda_ltr= 'T' and
t0.n_prog=t1.n_ prog) where t0._nprog<>0;

would be closer to what you want from the query. The join should give
output with either t0 extended by NULLs or t0 joined by t1 dependant on
whether t0.scheda_ltr=' T' and if it finds a matching row in t1.

Thank you Stephen, for your contribution: I'll study it in due course
... as I'm interested to learn as much as possible ...
However, in the meantime, I think I found the solution. What helped me
was the construction of these two testing tables:

Table "foo"
Column | Type | Modifiers
--------+-------------------+-----------
a | integer |
b | character varying |
c | character varying |
has_d | character(1) |

# which I filled with:

a | b | c | has_d
---+------+--------+-------
1 | one | number | Y
2 | two | number | Y
3 | tree | name | Y
4 | blue | color | N
5 | john | person | N
(5 rows)

# and:

Table "foo_d"
Column | Type | Modifiers
--------+---------+-----------
a | integer |
d | text |

# bearing my 'would-be' memo field:

a | d
---+----------------------------------
1 | is the first natural
2 | follows 1 in the seq of natural
3 | there are various qualities of -
(3 rows)

# Then I launched an 'nth' variant of my query:

SELECT DISTINCT
--- t0.a, t0.b, t0.c, t0.has_d, -- t1.d,
-- t0.has_d, -- ## ok, mostr prima i due 'N' e poi due volte quelli Y
-- ## se tolgo 't0.has_d', cambia ordine ma sempre 8
-- ## sono
CASE
WHEN t0.has_d = 'Y' AND t0.a=t1.a
THEN t0.a || ' - ' || t0.b || ' - ' || t0.c || ' - ' || t1.d
ELSE
CASE
WHEN t0.has_d = 'N'
THEN t0.a || ' / ' || t0.b || ' / ' || t0.c -- || ' / ' || t0.has_d
END
END AS "The result is: "
FROM foo t0, foo_d t1;


Note however, that this may very well perform poorly compared to other
solutions because as foo and foo_d get large, you're going to be
evaluating the case clause alot. In addition, this gives an extra NULL
row AFAICS (see below where you get a "blank" row and the rowcount is 1
higher than the meaningful number of rows.
The result is:
----------------------------------------------------
1 - one - number - is the first natural
2 - two - number - follows 1 in the seq of natural
3 - tree - name - there are various qualities of -
4 / blue / color
5 / john / person

(6 rows)

# which is exaclty what I was looking for :-)))))

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #11
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 09:05]:

On Fri, 10 Sep 2004, Ennio-Sr wrote:
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 07:10]:
On Fri, 10 Sep 2004, Ennio-Sr wrote:
[ big cut ]


Note however, that this may very well perform poorly compared to other
solutions because as foo and foo_d get large, you're going to be
evaluating the case clause alot. In addition, this gives an extra NULL
row AFAICS (see below where you get a "blank" row and the rowcount is 1
higher than the meaningful number of rows.

Stephan,
I just tested my query on the main tables (bibl_lt and bidbt) and it
seems to work reasonably quickly (my tables are not all that large:
around 10.000 rows only!). But, if it is possible to get a better
result, why not?
So, when you say '..compared to other solutions..' are you thinking
about 'COALESCE' (which I have not studied yet) or some other type
of instruction, other than psql's?
TIA,
Ennio

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why to use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (used to say Henry Miller) ]

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #12
On Fri, 10 Sep 2004, Ennio-Sr wrote:
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 09:05]:

On Fri, 10 Sep 2004, Ennio-Sr wrote:
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 07:10]:
> On Fri, 10 Sep 2004, Ennio-Sr wrote:
> [ big cut ]


Note however, that this may very well perform poorly compared to other
solutions because as foo and foo_d get large, you're going to be
evaluating the case clause alot. In addition, this gives an extra NULL
row AFAICS (see below where you get a "blank" row and the rowcount is 1
higher than the meaningful number of rows.

Stephan,
I just tested my query on the main tables (bibl_lt and bidbt) and it
seems to work reasonably quickly (my tables are not all that large:
around 10.000 rows only!). But, if it is possible to get a better
result, why not?
So, when you say '..compared to other solutions..' are you thinking
about 'COALESCE' (which I have not studied yet) or some other type
of instruction, other than psql's?


Well, I'd expect that for large tables the outer join type solution would
tend to be faster than joining every row to every other row and then using
a unique step (probably after a sort) to basically remove the ones you
don't want. If you try different solutions, you can use EXPLAIN ANALYZE to
compare query plans.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #13
* Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 10:39]:
On Fri, 10 Sep 2004, Ennio-Sr wrote:
> * Stephan Szabo <ss****@megazon e.bigpanda.com> [100904, 07:10]:
> > On Fri, 10 Sep 2004, Ennio-Sr wrote:
> > [ big cut ]


Well, I'd expect that for large tables the outer join type solution would
tend to be faster than joining every row to every other row and then using
a unique step (probably after a sort) to basically remove the ones you
don't want. If you try different solutions, you can use EXPLAIN ANALYZE to
compare query plans.


Please forget my previous message: I've just finished trying your
'COALESCE' solution (prior to studying it ;) ) and it seems to work
greatly!

---------
SELECT
t0.a, t0.b, t0.c, COALESCE(t1.d, ' ') as note from foo t0 left OUTER
JOIN foo_d t1 on (t0.has_d = 'Y' AND t0.a=t1.a);

# the result is:

a | b | c | note
---+------+--------+----------------------------------
1 | one | number | is the first natural
2 | two | number | follows 1 in the seq of natural
3 | tree | name | there are various qualities of -
4 | blue | color |
5 | john | person |
(5 rows)
^^^
---------
Perfect, I would say :-)
Thank you again so much indeed, Stephan.
Ennio.

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why to use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (used to say Henry Miller) ]

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2176
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to become visible....If they keep the dropdown box at "No" (default) then I want to submit the form "as is", keeping the inapplicable HTML fields hidden....I'm trying an "if statement" in ASP....Here's my code....I'm thinking that the if statement...
13
40802
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
10
13471
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group related to checkboxes. Thanks!!!
19
6939
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
2
4458
by: Marc | last post by:
I'm back in the Access development mode and seem to have forgotten how to do 2 things that should be simple. I have a database with a table of contacts, companies and activities. The idea is that I'll put in a list of companies, a bunch of contacts that work at each company, and an activities form that allows me to input every activity I do for each contact. The activities table includes a lookup field (also named contactID) for...
0
377
by: Ennio-Sr | last post by:
Hi all! After a very long struggle I finally succeded in transferring my old *.dbf file and the relating *.dbt (alias memo fields) to a pg table. For the time being I put the memo field in a separate table having two fields only (i.e.: n_memo integer, memo text) which can be related to the main table in a view.
3
3134
by: Bob Sanderson | last post by:
I am trying to create a form for a MySQL database similar to a spreadsheet. The idea is to display a list of records, with the last line of the list being an input form. When the user enters data in the form and hits the submit button, the data is entered and the form is reloaded with the new data displayed and another input form becomes the last line. Example --- Before entering new data
1
2300
by: Benny Ng | last post by:
Dear All, Now I met one problem in the development of my one application. I have one ASP.NET page. It's for disply the information of customer. But now I have one new requirement. It's to combine the "Edit" and "Display" funtions into this page. (It means if user want to edit the customer information, this page would provided editing page to the user; If the user want to display the customer information, this page would providev the...
2
3101
by: giandeo | last post by:
Hello all, It's almost a couple of weeks since i am struggling to get this code work. Unfortunately, i am stuck. There seems to be no hope... Please Help....... I am working with an asp page that dynamically pulls info from my database to populate a drop down menu. Upon an onChange event, I wish to display the fields related to that pull down menu WITHOUT SUBMITTING THE PAGE. The Senario: Database name: sp.mdb
2
3437
by: plsHelpMe | last post by:
Hi All, I am facing a weired issue. I am having a search form with some of the fields on it and a button which submits these fields values. Functionaly everything is working fine but sometimes when i try to submit my search form i can see the fields which are hidden using the style "display:none " visible for a moment just before my page is submitted. I am providing the html code behind those components as follows: <div class="formline...
0
9997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10863
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9666
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7201
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5887
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4720
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4300
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3317
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.