docs(troubleshooting): a worked URL-parameter example for the hook read
This commit is contained in:
@@ -196,16 +196,26 @@ A service called directly (for instance from a URL, or by a script), or by an ol
|
|||||||
|
|
||||||
### Reading the tables from a hook
|
### Reading the tables from a hook
|
||||||
|
|
||||||
A [hook script](macros.md) is `%include`d into the running service, so it shares the service's WORK library and can read the tables directly. To pick up a URL parameter by name:
|
A [hook script](macros.md) is `%include`d into the running service, so it shares the service's WORK library and can read the tables directly. Take an embedded editor opened at:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://datacontroller.io/#/editor/SASHELP.CLASS?labels=true&embed=va
|
||||||
|
```
|
||||||
|
|
||||||
|
`browser_url_vars` then holds a row per parameter - `labels=true` and `embed=va` - so a hook can pick up either by name:
|
||||||
|
|
||||||
```sas
|
```sas
|
||||||
%let labels=N;
|
%let labels=N;
|
||||||
|
%let embed=N;
|
||||||
|
|
||||||
%if %sysfunc(exist(work.browser_url_vars)) %then %do;
|
%if %sysfunc(exist(work.browser_url_vars)) %then %do;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select value into :labels
|
select value into :labels
|
||||||
from work.browser_url_vars
|
from work.browser_url_vars
|
||||||
where name = 'labels';
|
where name = 'labels';
|
||||||
|
select value into :embed
|
||||||
|
from work.browser_url_vars
|
||||||
|
where name = 'embed';
|
||||||
quit;
|
quit;
|
||||||
%end;
|
%end;
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user