Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuSetHash

Questions related to using nuBuilder Forte.
Locked
alf1976
Posts: 75
Joined: Tue Dec 26, 2017 8:58 pm

nuSetHash

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSetHash

Unread post by admin »

alf1976,

I think I know what you are saying.

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

Steven
alf1976
Posts: 75
Joined: Tue Dec 26, 2017 8:58 pm

Re: nuSetHash

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSetHash

Unread post 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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSetHash

Unread post 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
alf1976
Posts: 75
Joined: Tue Dec 26, 2017 8:58 pm

Re: nuSetHash

Unread post 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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSetHash

Unread post by admin »

Cool!

That's what I would have done.

Steven
Locked