Get data from API in Custom function

Tags: #<Tag:0x00007efc6b562b38>

Hi,

This question is continuing of Custom functions with arguments.

Custom function is working as expected. But i am trying to call API HTTP request but inside custom function i am not able to get api call.

class customCallbackFn extends FunctionPlugin {

public ServiceProxy: QklyAnnualizedItemsServiceProxy

paramFn(param, column, val) {

var me = this;

if (me) {

  me.ServiceProxy.getConditionTypeDetails('', '', 46, 1, 1).subscribe(result => {



  });

  return 3

}

else return 2;

}

lookupsheet(ast, state) {

return this.runFunction(

  ast.args,

  state,

  this.metadata("VLOOKUPSHEETFN"),

  this.paramFn

);

}

}

Hi @jubilee.mohamed

We have a repository dedicated for HyperFormula. You can post issues there so our Hyperformula developer can answer you directly.

Hi,

I am using runfunction in FunctionPlugin for showing API result. but it not working as expected due to return executed before the api response.

SO I used to promise inside the fn param but it showing this error

Argument of type ‘(result: any) => Promise’ is not assignable to parameter of type ‘(…arg: any) => InterpreterValue’.
Type ‘Promise’ is not assignable to type ‘InterpreterValue’.ts(2345)

View Problem (Alt+F8)

Quick Fix… (Ctrl+.)

sample code shared below :::::::::::::::::::::::

return this.runFunction(

  ast.args,

  state,

  this.metadata("VLOOKUPSHEETFN"),

  (param) => {

   let item =  this.paramFn();

   console.log("skjdbvds", item);

   return new Promise<any>((resolve, reject) => {
          return item =  Api call result 
   });

   return `Hello , ${item}!`;

  },

);

Hi @jubilee.mohamed

As I mentioned before, we have a separate issue board for Hyperformula related problems and there we have a dedicated developer who is an expert in this topic. I suggest to post your issue there so you will have a direct contact with our developer.

ok. Thank you @adrian.szymanski