Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Lookup Updating

Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Lookup Updating

Unread post by Eppo »

Hi There,

Since I have imported an older database from the replaced system. I have a problem with my lookup update script.

Code: Select all

function nuLoadThis() {

   if($('#recordID').val() == '-1'){
      $('#codekoop_klanten_id').change();
   }

}
I found this little script on http://forums.nubuilder.cloud/viewtopic.p ... ate#p10885 and it works great. Only when I have a customer (from the imported customers) and I want to put in a extra bought product, it wil only blink in the lookup field and wil not update some other fields Like when you do if you Look it up yourself (thats where this smal piece of script is for). With normal entered customers it works as it should be.

The Imorted customers have ID nummers 106000001 and counting
The normal customers have ID numbers like 1531f0b75ca3b2.

With the purchased products I have got the same problem and they got ID nummer 1919000001 and counting.

Can You help me with my problem. and do you know if this works better in the Pro version?

Thanks

Jeroen
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Lookup Updating

Unread post by massiws »

Eppo, are you saying that in customer table you have both records with ID build by nuBuilder with uniqid() function and records with numeric ID?Maybe this could be the problem...
Try to clone an imported record: nuBuilder assign to it a uniqid PK and you can see if it works.

Max
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Lookup Updating

Unread post by Eppo »

Max,

All of my imported consumers have 1 uniq ID. That is like 106000001 or New Customers have ID's like 1531f0b75ca3b2.

If I clone an imported customer with then it gets a ID like 1531f0b75ca3b2, but then is there no connection with my bought products witch are allready in the system.

I have got 8000 customers imported and over 30.000 bought products, so change them manualy isn't realy an option.

Can Import them again only with a new bigger number be an solution?

Thanks for keeping up the good work! :D

Jeroen
Last edited by Eppo on Tue Mar 18, 2014 11:56 am, edited 1 time in total.
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Lookup Updating

Unread post by Eppo »

I've manualy changed 2 customers and there bought products to customer ID like ab106c619014751. And that is not a solution. I stil got the same error.

Maybe steve has a solution?

Thanks!

Jeroen
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Lookup Updating

Unread post by massiws »

Jeroen,
I made some tests on my db, changing some customer IDs to integer numbers (like your 106000001) but all works fine, also edit existing or adding new products.
Some suggestions:
  • are you sure that "ab106c619014751" is a uniqid code? It must be build with PHP uniqid() function (13 characters long);
  • PK and FK fields in MySQL must be the same type and size;
  • inspect with Firebug console: do you see any error when you pick up a new record in subform?
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Lookup Updating

Unread post by Eppo »

Hi Max,

All of the customers have a Uniq number witch is given from in the old program, so I assume it is not created with PHP uniqid() function. When I imported it into phpmyadmin it did not gave me a error. Klanten_id is a UNIQUE KEY (klanten is consumers in dutch).
- So if you say that I have to change the ID's to a 13 digit number with or without some letters I can do that, but I don't think that it wil work because i just found out that some of the new consumers (with have a nuBuilder Uniq ID) have the same problem.
- What do you mean with PK and FK fields? al the ID fiels are varchar(15) NOT NULL. Like the sample_nufinancial module.

With Firebug I see this for the lookup field

Code: Select all

<td class="selected" style="text-align:left">
<input id="koop_klanten_id" type="hidden" value="106015396" name="koop_klanten_id">
<input id="codekoop_klanten_id" class="lookupcode" onclick="edit_lookup('151629be0a29d0', 'koop_klanten_id')" ondblclick="if(nuShiftKey){nuMoveObject(this.id.substring(4), 0,0);return;};nuControlKey=true;openIBrowse('151629ec00930e', '', '', '153298b8b1a6cf', '1532991f197417')" accept="151629ec00930e" onfocus="nuSetRow('');" onchange=";" style="width:144px;" value="Aalbersberg" name="codekoop_klanten_id">
<img id="luup_koop_klanten_id" class="lubutton" onclick=" nuSetRow(''); nuControlKey=true;openIBrowse('151629ec00930e', '', '', '153298b8b1a6cf', '1532991f197417') " onmousedown=" this.src='ludown.png'" onmouseout=" this.src='luup.png' " onmouseup=" this.src='luup.png' " style="vertical-align:text-bottom" alt="Lookup" src="luup.png">
<input id="descriptionkoop_klanten_id" type="hidden" tabindex="10000" readonly="readonly" style="width:0px;" value="" name="descriptionkoop_klanten_id">
</td>
And this for de the field that has to be updated.

Code: Select all

<td class="selected" style="text-align:left;white-space: nowrap;">
<input id="koop_klant_naam" class="readonly" type="text" tabindex="10000" readonly="readonly" ondblclick="if(nuShiftKey){nuMoveObject(this.id, 0,0);return;};" onfocus="nuSetRow('');" onchange="uDB(this,'text');" style="width:240px;text-align:left;vertical-align:top;" name="koop_klant_naam">
</td>
I don't see any wrong things, I hope you see something.

Thank allready for helping me.

Jeroen
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Lookup Updating

Unread post by massiws »

Jeroen, sorry but I can't reproduce your error.
Eppo wrote:...if you say that I have to change the ID's to a 13 digit number with or without some letters I can do that, but I don't think that it wil work because i just found out that some of the new consumers (with have a nuBuilder Uniq ID) have the same problem.
If you say that the problem appear also with record created with nuBuilder then problem is not related to IDs.

To understand why some record works fine and others fail, try to inspect your script, displaying variable values:

Code: Select all

function nuLoadThis() {
   console.log("recordID: " + $("#recordID").val() + " - LU: " + $("#codekoop_klanten_id").val() );
   if($('#recordID').val() == '-1'){
      $('#codekoop_klanten_id').change();
   }
}
Hope this helps,
Max
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Lookup Updating

Unread post by Eppo »

Max,


Maybe a stupid question, but where can I found the log of this script?


Jeroen
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Lookup Updating

Unread post by massiws »

It's the Firebug console:
Display log in Firebug Console
Display log in Firebug Console
FirebugConsole.png (15.69 KiB) Viewed 19392 times
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Lookup Updating

Unread post by Eppo »

I found it.

This are the answer: I have found 1 customer where it realy works...
Image

Al of the other (tested) customers give this reaction.
Image
Number 14 is every time a different number.

I hope you see something thats wrong.

Thanks!

Jeroen
Post Reply