nuSetHash

Questions related to using nuBuilder Forte.

nuSetHash

Postby alf1976 » Wed Dec 27, 2017 7:25 pm

Hi,

I have used this function quite a lot in v3 to store values for customising sql statements on browse forms. It is not listed on the wiki for version 4.
I can't see an alternative function.

For example, my customer database is split into three tables.
1) Customer Main Details.
2) Address sites. So Each customer can have multiple address attached these can be flagged as invoice, delivery or order addresses.
3) Contacts

i was using the NuSetHash function to store the customerID so when an Address Site or Contact browse form was used the sql statement read the the hash value (as part of WHERE statement)
and only showed sites relevant to the customerID.

Is there a different way to do this in version 4.
alf1976
 
Posts: 75
Joined: Wed Dec 27, 2017 5:28 am

Re: nuSetHash

Postby admin » Wed Dec 27, 2017 7:44 pm

alf1976,

I think I know what you are saying.

Does this help? https://www.youtube.com/watch?v=Inr_HQyfE_Q

Steven
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am

Re: nuSetHash

Postby alf1976 » Wed Dec 27, 2017 11:51 pm

Hi Steven,

no, but the video does help with ideas for replicating the browse control in v4.

https://imgur.com/a/rE5mz?s

See image. This is the v3 screen.
So when the user opens this form the javascript in custom code runs

function nuLoadEdit()
{
nuSetHash('CurEditCompID','#RECORD_ID#');
}

Then when the users click on the 'main site lookup' or the 'main contact lookup'.
The sql statement on their respective browse form attached to the lookup has "WHERE CompanyID = '#CurEditCompID#' " clause.
So when the browse opens it only shows contact or sites specifically for that customer.

I pretty much the same system for for the estimates, orders and invoices.

Does that make more sense?

Andrew.
alf1976
 
Posts: 75
Joined: Wed Dec 27, 2017 5:28 am

Re: nuSetHash

Postby admin » Thu Dec 28, 2017 8:45 am

Andrew,

Someone else asked a similar thing (I think) ... http://forums.nubuilder.com/viewtopic.php?f=19&t=9200

Let me know if this helps.

Steven
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am

Re: nuSetHash

Postby admin » Thu Dec 28, 2017 9:09 am

Andrew,

Your Lookup Form's Browse SQL can be filtered using values on the current Edit Form eg.

Code: Select all
SELECT * FROM address
WHERE add_customer_id = '#inv_customer_id#';   ##   (where inv_customer_id is the id of an Object on the current Edit Form.


Maybe this is more helpful than adding a Hash Cookie manually (we have changed the name from Hash Variable).

Steven
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am

Re: nuSetHash

Postby alf1976 » Thu Dec 28, 2017 7:33 pm

Hi Steven,

I added a hidden object containing the CompanyID to the form, changed the sql statment on the lookup browse and it worked fine.

Thankyou for your help

Andrew
alf1976
 
Posts: 75
Joined: Wed Dec 27, 2017 5:28 am

Re: nuSetHash

Postby admin » Thu Dec 28, 2017 10:07 pm

Cool!

That's what I would have done.

Steven
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am


Return to General