Optional parameters in function

Posted by: Fabrice.Mainguene on 13 May 2024, 12:32 am EST

  • Posted 13 May 2024, 12:32 am EST - Updated 13 May 2024, 12:37 am EST

    Hi,

    in the functions like SUBSTITUE, how can I know which parameters are mandatory and which are optional? (In Excel optional ones appear with )

  • Posted 13 May 2024, 6:35 pm EST

    Hi Fabrice,

    I was able to replicate the issue at my end with the latest version of SpreadJS V17.0.8. I could see that for some formulas like “SUBSTITUTE” the optional parameters are not enclosed within “”.

    I have escalated this issue to the concerned dev team for further investigation. The internal tracking id for the same is: SJS-24224. I will let you know when there is more info on this from the dev team.

    For a workaround, you could change the function parameters from the resources of the current culture. Refer to the following code snippet:

    let resources = GC.Spread.Common.CultureManager.getResources();
    let oldPrams = resources.Functions.SUBSTITUTE.parameters;
    // Change the Parameters
    resources.Functions.SUBSTITUTE.parameters = [oldPrams[0].name, oldPrams[1].name, oldPrams[2].name, `[${oldPrams[3].name}]`];
    GC.Spread.Common.CultureManager.addCultureInfo('en-US', null, resources);

    Sample: https://jscodemine.mescius.io/share/rISlbeQ6qEW6z9N0yb8VBw/?defaultOpen={"OpenedFileName"%3A["%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    In the sample, the fourth parameter of the “SUBSTITUTE” function has been enclosed in “”.

    Further, I could see that some other functions like “FIXED”, “DECIMAL” , “DAYS360” and more have the same issue. I have also mentioned these to the dev team.

    References:

    getResources() method: https://developer.mescius.com/spreadjs/api/classes/GC.Spread.Common.CultureManager#getresources

    addCultureInfo() method: https://developer.mescius.com/spreadjs/api/classes/GC.Spread.Common.CultureManager#addcultureinfo

    Regards,

    Ankit

  • Posted 13 May 2024, 6:57 pm EST

    Thanks

  • Posted 15 May 2024, 8:09 pm EST

    Hi,

    The devs have considered the issue as bug and a new bug issue has been created with internal tracking id: SJS-24260.

    I will let you know when there is more info on this from the dev team or when the issue will be resolved.

    Regards,

    Ankit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels