Advanced Capstone: 3.6 exercise help

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

Hi all, 

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

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

Here is the result, when i had .z.pg running 

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" ""




.z.pg

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

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

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

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

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

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

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

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

hdbH"tables[]"

s#`event`lap`sensor

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

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

the  sensor table is different to the one i load on disk 

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

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


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