Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Strange (perhaps) DropList ctrl behaviour
Strange (perhaps) DropList ctrl behaviour [message #33057] Tue, 05 July 2011 16:00 Go to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I am playing with the reference example SqlArray.
I have modified the schema description, in the lay file added a droplist, and feeded this one with some values

dl.Add(1,"uno");
dl.Add(2,"due");
dl.Add(3,"tre");

Then I connected it to 'detail'

detail.AddCtrl(DL, dl);

When I enter the values it seems to work (the keys of droplist are stored in the table).
But when I click to resume the stored values in the table the droplist remains empty while the others are populated with data.

It looks for me a strange behaviour but I could mistake. Any hint?

Thank you,
Luigi
  • Attachment: SqlArray.rar
    (Size: 2.45KB, Downloaded 359 times)
Re: Strange (perhaps) DropList ctrl behaviour [message #33170 is a reply to message #33057] Tue, 12 July 2011 23:58 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
forlano wrote on Tue, 05 July 2011 16:00

Hello,

I am playing with the reference example SqlArray.
I have modified the schema description, in the lay file added a droplist, and feeded this one with some values

dl.Add(1,"uno");
dl.Add(2,"due");
dl.Add(3,"tre");

Then I connected it to 'detail'

detail.AddCtrl(DL, dl);

When I enter the values it seems to work (the keys of droplist are stored in the table).
But when I click to resume the stored values in the table the droplist remains empty while the others are populated with data.

It looks for me a strange behaviour but I could mistake. Any hint?

Thank you,
Luigi



Rolling Eyes it seems that the sql gurus are already in holidays... or simply the DropList cannot be used with AddCtrl()+SqlArray.

Luigi
Re: Strange (perhaps) DropList ctrl behaviour [message #33174 is a reply to message #33170] Wed, 13 July 2011 08:35 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

1-st Ctrls must be defined not in layout. (Only like
	EditString author;

2nd
By code is not clear that you want to do in the end?


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Wed, 13 July 2011 09:18]

Report message to a moderator

Re: Strange (perhaps) DropList ctrl behaviour [message #33178 is a reply to message #33174] Wed, 13 July 2011 11:19 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Wed, 13 July 2011 08:35

1-st Ctrls must be defined not in layout. (Only like
	EditString author;

2nd
By code is not clear that you want to do in the end?


I've seen others Ctrls defined in Layout.
Any way I have super simplified my test case to only one SqlArray to explain better what I want to achieve.

In master SqlArray I added a droplist ctrl:

		country.Add(12,"Russia");
		country.Add(24,"Czech Republic");
		country.Add(31,"Italy");
                country.Add(36,"Zimbawe");
        		    
		master.SetTable(BOOK);
		master.AddKey(ID);
		master.AddColumn(AUTHOR, "Author").Edit(author);
		master.AddColumn(TITLE, "Title").Edit(title);
		master.AddColumn(COUNTRY, "Country").Edit(country);
		master.Appending().Removing();
		master.SetOrderBy(AUTHOR, TITLE);
 


I want to record in the database the key of the droplist but I want to see on the screen its value.
After some insertion I see the following
index.php?t=getfile&id=3375&private=0
As you see the table show a number (the key) in the third column and nobody knows what countries stand for those numbers.
Instead when I start editing an old row or inserting a new row, the value of the droplist appears

index.php?t=getfile&id=3376&private=0

What I would like is to show ALWAYS in the array the VALUE of the droplist and not its key. The test case is attached.

Thanks a lot,
Luigi
  • Attachment: pic1.jpg
    (Size: 22.94KB, Downloaded 777 times)
  • Attachment: pic2.jpg
    (Size: 23.31KB, Downloaded 740 times)
  • Attachment: SqlArray2.rar
    (Size: 1.56KB, Downloaded 322 times)
Re: Strange (perhaps) DropList ctrl behaviour [message #33179 is a reply to message #33178] Wed, 13 July 2011 13:08 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Use Convertor!

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Strange (perhaps) DropList ctrl behaviour [message #33183 is a reply to message #33179] Wed, 13 July 2011 15:31 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Wed, 13 July 2011 13:08

Use Convertor!


Rolling Eyes
I'm sorry for the silly question .... Embarassed ... what is it?
Can you add two more words?

Bolshoie spacibo,
Luigi
Re: Strange (perhaps) DropList ctrl behaviour [message #33187 is a reply to message #33183] Wed, 13 July 2011 17:35 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Your modified example in attachment
main.cpp contain Inserting in table COUNTRY_T for test purpose.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Strange (perhaps) DropList ctrl behaviour [message #33189 is a reply to message #33187] Wed, 13 July 2011 20:00 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Wed, 13 July 2011 17:35

Your modified example in attachment
main.cpp contain Inserting in table COUNTRY_T for test purpose.


Bolshoie Spasibo!

It works great Very Happy .
I believed that this behaviour should be the default. Instead there was necessary a trick.
I suggest to use this example as reference in a next release.

Poka,
Luigi
Re: Strange (perhaps) DropList ctrl behaviour [message #33190 is a reply to message #33189] Wed, 13 July 2011 20:50 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

This decision is not mine. Mirek suggested it to me when I suffered the same issue. Then I began to apply this solution everywhere.

So all thanks to Mirek. And from me too add. Wink


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Strange (perhaps) DropList ctrl behaviour [message #33197 is a reply to message #33189] Fri, 15 July 2011 11:05 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

[quote title=forlano wrote on Wed, 13 July 2011 22:00][quote
It works great Very Happy .
I believed that this behaviour should be the default. Instead there was necessary a trick.
I suggest to use this example as reference in a next release.
[/quote]

Maybe make template like this?
Lookup<table,key,keyfield,field_to_display>



SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Strange (perhaps) DropList ctrl behaviour [message #33202 is a reply to message #33197] Fri, 15 July 2011 20:07 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
[quote title=sergeynikitin wrote on Fri, 15 July 2011 11:05]
forlano wrote on Wed, 13 July 2011 22:00



Maybe make template like this?
Lookup<table,key,keyfield,field_to_display>



It would be very usefull. Unfortunatly template are off topic for me Smile

With PHP+MySql in an easy web application I used a special library that take care of an entire table and performs the lookup of the indicated column and CRUD operation. This simplifies a lot the work and let you create a front end for the final user in a matter of minutes.
When I wanted to replicate it with Upp that already performs the CRUD operation with SqlArray I believed to find out of box the lookup column.

Poka,
Luigi
Re: Strange (perhaps) DropList ctrl behaviour [message #33216 is a reply to message #33202] Sun, 17 July 2011 12:20 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Example and templates (by "#define")!
I comment out near important lines.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Strange (perhaps) DropList ctrl behaviour [message #33290 is a reply to message #33216] Fri, 22 July 2011 19:13 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1195
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Sun, 17 July 2011 12:20

Example and templates (by "#define")!
I comment out near important lines.


Prevet Sergey,

only today I had the possibility to test your code.
It works and seems very easy to use. I'll include in my project.
Thank you!

Luigi
Re: Strange (perhaps) DropList ctrl behaviour [message #60009 is a reply to message #33216] Fri, 07 July 2023 21:35 Go to previous message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
I know I'm bringing back an old post, but wanted to say thank you to sergeynikitin for his 'simple' converter, it helped me today on my Invoices app Smile
Previous Topic: Bitwise and, or, xor in sql
Next Topic: Sqlite bugfix: sqlite has no "nowait" option in select statements
Goto Forum:
  


Current Time: Tue Jul 23 17:47:56 CEST 2024

Total time taken to generate the page: 0.01511 seconds