Page 1 of 1

can only add to first lookup field?

Posted: 2020-01-14 23:53
by D Oliveira
please look at this image:

https://i.imgur.com/92jyZvc.png

even if i try to "add new" from the second or third or forth... policy it always replace the policy #1, is that a problem with lookups? it only allows to add new to the first lookup field?

Re: can only add to first lookup field?

Posted: 2020-01-16 20:02
by D Oliveira
running appgini 5.76 , just generated a sample from scratch without any of my custom code and this error still persists, it seems to be a bug, has anyone else experienced that?

Re: can only add to first lookup field?

Posted: 2020-01-16 20:36
by jsetzer
Hi,

I've not seen this behaviour before.

Actually, usually I normalize my tables to avoid such binding if possible. But there are projects in which I have tables with maximum 2 similar lookup bindings on the same parent field. This works well in both tables (child-table/parent-table). Honestly, I did not try with more than 2 similar lookups.
  • Did you verify database integrity with model in Admin-Area / "Rebuild fields"? All fields fine?
  • Can you please check if there are any Javascript errors in console tab and post them - if any.
  • You could consider normalizing the clients-table?
No more ideas right now, sorry!
Best,
Jan

Re: can only add to first lookup field?

Posted: 2020-01-16 20:55
by D Oliveira
jsetzer wrote:
2020-01-16 20:36
Hi,

I've not seen this behaviour before.

Actually, usually I normalize my tables to avoid such binding if possible. But there are projects in which I have tables with maximum 2 similar lookup bindings on the same parent field. This works well in both tables (child-table/parent-table). Honestly, I did not try with more than 2 similar lookups.
  • Did you verify database integrity with model in Admin-Area / "Rebuild fields"? All fields fine?
  • Can you please check if there are any Javascript errors in console tab and post them - if any.
  • You could consider normalizing the clients-table?
No more ideas right now, sorry!
Best,
Jan
Hi! thanks for trying but I need to bind the client to the policies, there isnt any other structure that would actually fit that.

[*] Did you verify database integrity with model in Admin-Area / "Rebuild fields"? All fields fine?
yes, all good there

[*] Can you please check if there are any Javascript errors in console tab and post them - if any.
no javascript errors, even built a fresh application from the start without any js and this error still persists

[*] You could consider normalizing the clients-table?
tried, and unsucessful :(


here is the .axp file uploaded in case someone can figure it out: https://www.sendspace.com/file/xz4fzh

Re: can only add to first lookup field?

Posted: 2020-01-16 21:13
by jsetzer
Hmm, with AppGini 5.81 I cannot reproduce the reported error.

I can create new policies #1, #2 and #3 using any of the (+) buttons next to the dropdown. Afterwards the created policy exists in the dropdown as expected. After save, those values get restored as expected, too.
chrome_LOyOXZUTA6.png
chrome_LOyOXZUTA6.png (31.12 KiB) Viewed 6205 times
  • Maybe it's related to your outdated version?
  • Or maybe I did not get the problem.
I can only see a small, non-critical display bug:
When hovering over any of the (+) buttons, there is always the identical tooltip from the first combo:
chrome_CJ0XNQ57Hm.png
chrome_CJ0XNQ57Hm.png (27.19 KiB) Viewed 6205 times

Re: can only add to first lookup field?

Posted: 2020-01-16 21:18
by D Oliveira
jsetzer wrote:
2020-01-16 21:13
Hmm, with AppGini 5.81 I cannot reproduce the reported error.

I can create new policies #1, #2 and #3 using any of the (+) buttons next to the dropdown. Afterwards the created policy exists in the dropdown as expected. After save, those values get restored as expected, too.

chrome_LOyOXZUTA6.png

  • Maybe it's related to your outdated version?
  • Or maybe I did not get the problem.
I can only see a small, non-critical display bug:
When hovering over any of the (+) buttons, there is always the identical tooltip from the first combo:
chrome_CJ0XNQ57Hm.png
I guess thats some good news, but before spending $ to upgrade I'll just wait to hear from Ahmed to see if there is an easy fix for that, thank you for confirming that info to me, much appreciated

Re: can only add to first lookup field?

Posted: 2020-01-16 21:32
by D Oliveira
upgraded to 5.81, error still happening, but now console shows this:

https://imgur.com/YuKIp9H

Re: can only add to first lookup field?

Posted: 2020-01-16 21:43
by D Oliveira
actually here is the full log:

https://imgur.com/22ZmiFg

Re: can only add to first lookup field?

Posted: 2020-01-17 06:36
by pbottcher
Hi,
I can confirm that this happens on 5.81 as well. Once a new entry for the lookup is created it defaults always to the first lookup for update as the id's for all lookup are identical and hence the first is picked.

Re: can only add to first lookup field?

Posted: 2020-01-17 10:26
by onoehring
Hi D Oliveira,

I do not really understand, why you could not normalize your clients table as Jan suggested. IMHO AG provides an easy way to create nice looking pages with master-client records.
I tried to give you a hint by changing your provided file a little. When you generate this, you should be able to add policies as usual to a client (I did not test this).
You can also download the changed axp file here: https://dl.olaf-noehring.de/?t=109f03d4 ... 1349c90661

It looks now like this:
ec202003.png
ec202003.png (32.8 KiB) Viewed 6177 times
Olaf

Re: can only add to first lookup field?

Posted: 2020-01-17 13:48
by D Oliveira
onoehring wrote:
2020-01-17 10:26
Hi D Oliveira,

I do not really understand, why you could not normalize your clients table as Jan suggested. IMHO AG provides an easy way to create nice looking pages with master-client records.
I tried to give you a hint by changing your provided file a little. When you generate this, you should be able to add policies as usual to a client (I did not test this).
You can also download the changed axp file here: https://dl.olaf-noehring.de/?t=109f03d4 ... 1349c90661

It looks now like this:
ec202003.png

Olaf
Thank you for that, I just added a clientID field to the policies table and binded it directly, awesome solution =)

Re: can only add to first lookup field?

Posted: 2020-01-18 08:32
by onoehring
Hi D Oliviera,

great that it seems to work now. From experience I want to add, that if you use normalized tables you do yourself a favour in many places - so my tip: normalize :-)

Olaf