# Advanced Capstone: 3.6 exercise help

**URL:** <https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176>\
**Category:** Academy Support\
**Tags:** imported\
**Created:** [March 19, 2025, 8:58am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176 "2025-03-19T08:58:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 19, 2025, 8:58am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/1 "2025-03-19T08:58:45Z")

</div>

[https://learninghub.kx.com/forums/topic/advanced-capstone-3-6-exercise-help-2](https://learninghub.kx.com/forums/topic/advanced-capstone-3-6-exercise-help-2)

Hi all,&nbsp;

I have been hitting type error when i tried to run .z.pg for exercise 6&nbsp;

Please help to check my .z.pg function in the replies below

> Here is the result, when i had .z.pg running&nbsp;
> 
> ```
> quizItem success description error   
> -----------------------------------------------------------------------  
> exercise3.2 Pass "check password col is updated" ""   
> exercise3.3 Fail ".perm.users should exist on HDB process" "type"  
> exercise3.4 Fail "define .z.pw on HDB process" "type"  
> exercise3.4 Pass "give access to users with correct password" ""   
> exercise3.4 Pass "give access to users with wrong password" ""   
> exercise3.5 Fail "return first element of parse tree" "type"  
> exercise3.5 Fail "return ! if given update query" "type"  
> exercise3.6 Fail "define .z.pg on remote process" "type"  
> exercise3.6 Fail "fiauser can run one function" "type"  
> exercise3.6 Fail "fiauser cant run tables[]" ""   
> exercise3.6 Fail "team members can run any function" "type"
> ```
> 
> ```
> If i have the .z.pg reset, my tables are working fine
> 
> quizItem success description error ------------------------------------------------------------------------ exercise3.2 Pass "check password col is updated" "" exercise3.3 Pass ".perm.users should exist on HDB process" "" exercise3.4 Pass "define .z.pw on HDB process" "" exercise3.4 Pass "give access to users with correct password" "" exercise3.4 Pass "give access to users with wrong password" "" exercise3.5 Pass "return first element of parse tree" "" exercise3.5 Pass "return ! if given update query" "" exercise3.6 Fail "define .z.pg on remote process" ".z.pg" exercise3.6 Pass "fiauser can run one function" "" exercise3.6 Fail "fiauser cant run tables[]" "" exercise3.6 Pass "team members can run any function" ""
> ```

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 19, 2025, 9:03am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/2 "2025-03-19T09:03:27Z")

</div>

.z.pg

hdbH ".z.pg:{permission:.perm.users[.z.u;`api];test:.perm.parseQuery[x];$[permission~`all;value x;($[test~permission;value x;:`notAuthorized])]}"

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 19, 2025, 9:05am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/3 "2025-03-19T09:05:47Z")

</div>

ex4: hdbH ".z.pw :{[user;pswd]$[(.Q.sha1 pswd) in select password from `.perm.users;1b;0b]}"

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 19, 2025, 9:06am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/4 "2025-03-19T09:06:12Z")

</div>

ex5: .perm.parseQuery: { first parse x}

hdbH (set;`.perm.parseQuery;.perm.parseQuery)

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 19, 2025, 9:06am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/5 "2025-03-19T09:06:23Z")

</div>

ex2:.perm.users: ("S\*S";enlist "\t")0: hsym `$getenv[`AX\_WORKSPACE],"/AdvancedCapstone.Data/users.txt"

update password: .Q.sha1 each password from `.perm.users

---

<div class="post-metadata">

**Author:** ![abstrphil](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@abstrphil](https://forum.kx.com/u/abstrphil)\
**Post date:** [March 19, 2025, 9:30am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/6 "2025-03-19T09:30:31Z")

</div>

Probably doesn't help with your problem, but you can un-nest the multiple ifs:

https://code.kx.com/q/ref/cond/#odd-number-of-expressions

---

<div class="post-metadata">

**Author:** ![mwoods](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/mwoods/32/35_2.png) [@mwoods](https://forum.kx.com/u/mwoods)\
**Post date:** [March 19, 2025, 10:46am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/7 "2025-03-19T10:46:05Z")

</div>

This looks correct - you problem is more likely environmental as when I checked your instance the f1 database was missing, I rebooted and reloaded it and ran this code and 3.6 passes. Please DM me if you continue to have issues

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 20, 2025, 2:20am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/8 "2025-03-20T02:20:17Z")

</div>

Hi there, i did load the f1 tables in the hdbH , however im hitting the same issue

hdbH"tables[]"

s#`event`lap`sensor

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 20, 2025, 2:42am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/9 "2025-03-20T02:42:32Z")

</div>

hdbH"sensor"

hdbH "event"

hdbH "lap"

```
date sensorId  
-------------------  
2020.01.02 2   
2020.01.02 3   
2020.01.02 3
```

```
date session lapId time endTime   
--------------------------------------------------  
2020.01.01 P1 1 11:00:26.033 11:00:36.611  
2020.01.01 P1 2 11:00:36.611 11:06:59.897  
2020.01.01 P1 3 11:06:59.897 11:12:06.853  
2020.01.01 P1 4 11:12:06.853 11:19:25.885  
2020.01.01 P1 5 11:19:25.885 11:25:02.752  
2020.01.01 P1 6 11:25:02.752 11:27:11.547  
2020.01.01 P1 7 11:27:11.547 11:36:08.701  
2020.01.01 P1 8 11:36:08.701 11:43:41.360  
2020.01.01 P1 9 11:43:41.360 11:45:51.509  
2020.01.01 P1 10 11:45:51.509 11:45:55.556

date sensorId session lapId time endTime sensorValue ----------------------------------------------------------------------------- 2020.01.02 tempBackLeft P3 1 12:00:42.329 12:01:14.042 20.61488 2020.01.02 tempBackLeft P3 2 12:01:14.042 12:02:27.094 20.62392 2020.01.02 tempBackLeft P3 3 12:02:27.094 12:02:54.318 20.61883 2020.01.02 tempBackLeft P3 4 12:02:54.318 12:16:52.146 20.621 2020.01.02 tempBackLeft P3 5 12:16:52.146 12:17:12.914 20.61416 2020.01.02 tempBackLeft P3 6 12:17:12.914 12:17:30.610 20.62186 2020.01.02 tempBackLeft P3 7 12:17:30.610 12:21:49.433 20.61864 2020.01.02 tempBackLeft P3 8 12:21:49.433 12:23:43.561 20.61508 2020.01.02 tempBackLeft P3 9 12:23:43.561 12:28:25.547 20.62206 2020.01.02 tempBackLeft P3 10 12:28:25.547 12:28:36.391 20.62515 2020.01.02 tempBackLeft P3 11 12:28:36.391 12:28:56.155 20.60884 2020.01.02 tempBackLeft P3 12 12:28:56.155 12:32:36.277 20.61889 2020.01.02 tempBackLeft P3 13 12:32:36.277 12:39:54.766 20.62077 2020.01.02 tempBackLeft P3 14 12:39:54.766 12:43:03.983 20.62077 2020.01.02 tempBackLeft P3 15 12:43:03.983 12:55:41.601 20.62054 2020.01.02 tempBackLeft P3 16 12:55:41.601 12:56:32.863 20.61843
```

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 20, 2025, 2:55am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/10 "2025-03-20T02:55:53Z")

</div>

only issues im noticing is that after i load f1 database to the process,&nbsp;

the&nbsp; sensor table is different to the one i load on disk&nbsp;

```
hdbH"meta sensor"

c | t f a  
--------| -----  
date | d   
sensorId| j
```

```
meta sensor

c | t f a  
-----------| -----  
date | d   
sensorId | s p  
time | t   
lapId | j   
units | s   
sensorValue| f   
session | s
```

---

<div class="post-metadata">

**Author:** ![holly1](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/holly1/32/128_2.png) [@holly1](https://forum.kx.com/u/holly1)\
**Post date:** [March 20, 2025, 3:19am UTC](https://forum.kx.com/t/advanced-capstone-3-6-exercise-help/14176/11 "2025-03-20T03:19:02Z")

</div>

dont think this is the issue, i reboot and load the database again , the tables are matching&nbsp;

```
hdbH"meta sensor"

c | t f a  
-----------| -----  
date | d   
sensorId | s p  
time | t   
lapId | j   
units | s   
sensorValue| f   
session | s
```

```
meta sensor

c | t f a  
-----------| -----  
date | d   
sensorId | s p  
time | t   
lapId | j   
units | s   
sensorValue| f   
session | s
```
