Hi there, I have a subform and want to log the User ID to be written autmaticly in one of the fields when creating an entry. How can I achieve this?
Best regards
marcus
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Logging the User ID
-
- nuBuilder Team
- Posts: 4565
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
Re: Logging the User ID
Hi,
Add a varchar(1000) starting with the table's name followed by _nulog, to a table and nuBuilder Forte will start automatically logging activity to each record in that table.
https://wiki.nubuilder.cloud/index.php? ... g_Activity
Add a varchar(1000) starting with the table's name followed by _nulog, to a table and nuBuilder Forte will start automatically logging activity to each record in that table.
https://wiki.nubuilder.cloud/index.php? ... g_Activity
-
- Posts: 20
- Joined: Mon Nov 29, 2021 10:16 am
Re: Logging the User ID
Hi adn thanks a lot, that is pretty handy!
Is there any pre-made way to just extract the creating user or creating time for example (like a function)?
Otherwise I will write my own query.
Is there any pre-made way to just extract the creating user or creating time for example (like a function)?
Otherwise I will write my own query.
-
- nuBuilder Team
- Posts: 4565
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
-
- Posts: 20
- Joined: Mon Nov 29, 2021 10:16 am
Re: Logging the User ID
Hey, thanks
I dont know how I can display the values added_user, added_time, edited_user, edited_time inside the subform, do you know how i can achieve this?
My Browse SQL Statement is
I dont know how I can display the values added_user, added_time, edited_user, edited_time inside the subform, do you know how i can achieve this?
My Browse SQL Statement is
Code: Select all
SELECT
order_comment_id,
order_comment_order,
order_comment_text,
added_user,
added_time,
edited_user,
edited_time
FROM
(
SELECT
order_comment_id, order_comment_order, order_comment_text,
JSON_UNQUOTE(JSON_EXTRACT(order_comment_nulog, '$.added.user')) as added_user,
FROM_UNIXTIME(JSON_EXTRACT(order_comment_nulog, '$.added.time')) as added_time,
JSON_UNQUOTE(JSON_EXTRACT(order_comment_nulog, '$.edited.user')) as edited_user,
FROM_UNIXTIME(JSON_EXTRACT(order_comment_nulog, '$.edited.time')) as edited_time
FROM order_comment
) T
-
- nuBuilder Team
- Posts: 4565
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
-
- Posts: 20
- Joined: Mon Nov 29, 2021 10:16 am
Re: Logging the User ID
Could you please point me in the right direction here?
In a display object inside the subform I tried
And the output is #added_user#, so it seems like the hash cookie isnt existing
In a display object inside the subform I tried
Code: Select all
SELECT '#added_user#'
-
- nuBuilder Team
- Posts: 4565
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
Re: Logging the User ID
For each display object, you need to select the corresponding nulog field for that row. E.g.
Code: Select all
SELECT
JSON_UNQUOTE(JSON_EXTRACT(order_comment_nulog, '$.added.user'))
FROM order_comment
WHERE order_comment_id = '#RECORD_ID#'