Hello,
I am using angularjs to invoke runCode action while I came across the error"table does not exist".
Below is my code.
var loadT={caslib:'MYCASLIB3',path:'cart.sashdat',casout:{name:'cart',caslib:'MYCASLIB3'}};
var Code={code:"data cart;set cart;run;"};
$http({
method:'POST',
url:baseURL+'/actions/loadTable',
headers:_headers,
params:loadT
}).then(function(){$http({
method:'POST',
url:baseURL+'/actions/runCode',
headers:_headers,
params:Code
}).then(function callBack(response){console.log(response);});});
So you can see that before I invoked the runCode action i have already excecuted loadTable action, I know I loaded table sucessfully otherwisde I cannot get the runCode action executed. I don't know why I still receive an error that " ERROR: The table cart in caslib MYCASLIB3 does not exist." , which means that it did look for cart in the caslib MYCASLIB3, but it does not find it.
Anybody knows why?
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now:
Just to complete the thought:
if you call cas action via REST (or by scripting) always check the disposition object in the response.
While cas will return a http code of 200 when you have programming errors it does return useful information in the disposition object and in the log object. You should always check the disposition object before going to the next step - bullet proof your app.
A typical code might look like this:
if (dispostion.statusCode !== 0 || disposition.severity === ‘Error’) {
throw ‘Huston we have a problem’;
} else {
…do whatever you want…
}
And a second thought:
If you plan to make a series of REST calls for cas actions, consider switching to scripting on the server using the casl language via the sccasl.runcasl action. This will save you multiple round trips to the server. You can use the casl language features to script your actions.
Cheers...
Deva
PS: If you are using REST API to access Viya please take a look at https://github.com/sassoftware/restaf for a very useful js library.
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.