Page 1 of 1

nuSetHash

Posted: Wed Dec 27, 2017 10:55 am
by alf1976
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.

Re: nuSetHash

Posted: Wed Dec 27, 2017 11:14 am
by admin
alf1976,

I think I know what you are saying.

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

Steven

Re: nuSetHash

Posted: Wed Dec 27, 2017 3:21 pm
by alf1976
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.

Re: nuSetHash

Posted: Thu Dec 28, 2017 12:15 am
by admin
Andrew,

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

Let me know if this helps.

Steven

Re: nuSetHash

Posted: Thu Dec 28, 2017 12:39 am
by admin
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

Re: nuSetHash

Posted: Thu Dec 28, 2017 11:03 am
by alf1976
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

Re: nuSetHash

Posted: Thu Dec 28, 2017 1:37 pm
by admin
Cool!

That's what I would have done.

Steven