Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Subform customization
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Subform customization
Ion2,
Rather than confusing the task by trying to do so many things at once, Try doing (or asking) just one thing.
Then when you understand that you are more likely to figure the rest out.
The more complicated your question less chance I'll get around to asking it quickly.
Steven
Rather than confusing the task by trying to do so many things at once, Try doing (or asking) just one thing.
Then when you understand that you are more likely to figure the rest out.
The more complicated your question less chance I'll get around to asking it quickly.
Steven
-
- Posts: 1
- Joined: Wed Mar 09, 2016 4:00 am
- Contact:
Re: Subform customization
I have been concerned about this topic and have been looking for answers. Hoping to find the best solution, we look forward to your sharing. Thank you.
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: Subform customization
Dear amarisJones,
I have decided to use a workaround. There is an other issue by using build-in log-function (http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button) of nuBuilder. My trigger starts with:
Some times in this case the inventory_log_changed_by is still emty after copying into my table inventory_log. The reason seems to be that the log-function writes several times into the table. Therefore I decided to use a workaround:
The key will be the Hash Variables(http://wiki.nubuilder.net/nubuilderv3/i ... _Variables). I want to insert #nu_user_name# into my table prior save by using Form / Custom Code / Before Save.
The code for that should be something like:
(see also: http://forums.nubuilder.cloud/viewtopic.php?f=4&t=8850)
I have not tried it yet but I keep you updated. Please give feedback, if it worked for you.
Greetings,
Timo
I have decided to use a workaround. There is an other issue by using build-in log-function (http://wiki.nubuilder.net/nubuilderv3/i ... ave_Button) of nuBuilder. My trigger starts with:
Code: Select all
IF NEW.inventory_log_changed_at <> OLD.inventory_log_changed_at THEN
INSERT INTO inventory_log
The key will be the Hash Variables(http://wiki.nubuilder.net/nubuilderv3/i ... _Variables). I want to insert #nu_user_name# into my table prior save by using Form / Custom Code / Before Save.
The code for that should be something like:
Code: Select all
$s = "
UPDATE inventory
SET inventory_MODIFIED_by = '#nu_user_name#'
";
nuRunQuery($s);
I have not tried it yet but I keep you updated. Please give feedback, if it worked for you.
Greetings,
Timo
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: Subform customization
Hi, this is working:
but I want to put the CURRENT_TIMESTAMP into field inventory_log_modified_at.
These three options do not work:
I learned not to interfere with zzzsys_user_log_changed_at.
Greetings,
Timo
Code: Select all
$s = "
UPDATE inventory
SET inventory_log_modified_by = '#nu_user_name#'
WHERE INVENTRORY_ID = '#RECORD_ID#'
";
nuRunQuery($s);
These three options do not work:
- SET inventory_log_modified_at = '#CURRENT_TIMESTAMP#'
- SET inventory_log_modified_at = CURRENT_TIMESTAMP
- SET inventory_log_modified_at = NOW()
I learned not to interfere with zzzsys_user_log_changed_at.
Greetings,
Timo
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: Subform customization
This ist not working as Custom Code in Before Save:
Using NOW(); in the Database only gives me the current date, when inserting a new row into the table. This is not what I want. I want to track the modification date independent from the “XYZ_log_changed_at” system field.
How can I insert the current date by using Custom Code in Before Save?
Thx, Timo
Code: Select all
$s = "
UPDATE inventory
SET inventory_log_TN_modified_by = '#nu_user_name#'
SET inventory_log_modified_at = NOW();
WHERE INVENTRORY_ID = '#RECORD_ID#'
";
nuRunQuery($s);
How can I insert the current date by using Custom Code in Before Save?
Thx, Timo
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Subform customization
Timo,
I dont understand your question (does the sql you tried work?)
Steven
I dont understand your question (does the sql you tried work?)
Steven
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: Subform customization
Steven,
the code
is not working. I'll get the following Error:
Whithout
the code is working.
Greetings,
Timo
the code
Code: Select all
$s = "
UPDATE inventory
SET inventory_log_TN_modified_by = '#nu_user_name#'
SET inventory_log_modified_at = NOW();
WHERE INVENTRORY_ID = '#RECORD_ID#'
";
nuRunQuery($s);
Whithout
Code: Select all
SET inventory_log_modified_at = NOW();
Greetings,
Timo
-
- Posts: 28
- Joined: Sat Apr 30, 2016 2:51 am
Re: Subform customization
use date() before call to you php code
nuSetHash('LogModDate',date());
// then call your php code
...
your-field = '#LogModDate#'
...
nuSetHash('LogModDate',date());
// then call your php code
...
your-field = '#LogModDate#'
...
-
- Posts: 41
- Joined: Mon Jan 18, 2016 3:01 pm
Re: Subform customization
Dear Hanstel,
I still didn't get the clue.
...or that?
Both aren't working for me. Could you give me another hint?
Thx, Timo
I still didn't get the clue.
Is this what you mean?hanstel wrote:use date() before call to you php code
nuSetHash('LogModDate',date());
// then call your php code
...
your-field = '#LogModDate#'
...
Code: Select all
nuSetHash('LogModDate',date());
$s = "
UPDATE inventory
SET inventory_log_TN_modified_by = '#nu_user_name#'
SET inventory_log_modified_at = '#LogModDate#'
WHERE INVENTRORY_ID = '#RECORD_ID#'
";
nuRunQuery($s);
Code: Select all
$s = "
nuSetHash('LogModDate',date());
UPDATE inventory
SET inventory_log_TN_modified_by = '#nu_user_name#'
SET inventory_log_modified_at = '#LogModDate#'
WHERE INVENTRORY_ID = '#RECORD_ID#'
";
nuRunQuery($s);
Thx, Timo