• Resolved geraldeder1

    (@geraldeder1)


    Hi, I find your calculator really interesting but i am not sure if it can do what I need: I made a tax calculator draft in Excel that contains functions such as :
    – IF()
    – MIN()
    – MAX()
    – ISNA()
    – ISBLANK()

    Now how can your plugin do those calculations?

    • This topic was modified 8 years, 5 months ago by geraldeder1.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi @geraldeder1,

    Our plugin is not exactly an Excel emulator, however, some operations are included in the plugin, but in the case of the operations that are not included, it is possible to implement an alternative with javascript.

    The existent operations:

    IF(condition, result when the condition is true, result when the condition is false)

    for example:

    IF(fieldname1>10, fieldname2+fieldname3,fieldname2*fieldname3)

    MIN(value A, value B, value C) return the minimum of the values passed as parameter, you can use as many parameters for comparing as needed.

    for example:

    MIN(3,54,1) = 1

    MAX(value A, value B, value C) return the maximum of the values passed as parameters, you can use as many parameters for comparing as needed.

    for example:

    MAX(3,54,1) = 54

    About the other two functions in our plugin if you are using a numeric field, and it is empty, its value would be considered as zero. For example, if the fieldname1 is a number field, you can check it as follows:

    IF(fieldname1, 'It has a value', 'It is empty or zero')

    but if the field is textual, you can use a regular expression:

    IF( !/^\s*$/.test(fieldname1), 'It has a value', 'It is empty')

    Best regards.

    Thread Starter geraldeder1

    (@geraldeder1)

    That sounds fantastic. Thank you so much for the support.

    One more quick question: Can you also do the equivalent of vlookup a value from a table (in the background)?

    Plugin Author codepeople

    (@codepeople)

    Hi @geraldeder1,

    As I said previously, our plugin is not an Excel emulator, so, there are not concepts like rows and columns like in Excel.

    For example, If you are using the developer version of the plugin, with RecordSet fields for loading CSV files, you can filtering its values but walking through the array of records. (More information in the “Using Recordset as datasource” section, on the documentation page of the plugin: https://cff.dwbooster.com/documentation )

    With other versions of the plugin there are some alternatives, for example: if you have created an array of objects directly with javascript, as follows:

    var obj_array = [
    {'column_a': 12, 'column_b':23, 'column_c': 123},
    {'column_a': 23, 'column_b':1231, 'column_c': 34},
    {'column_a': 2, 'column_b':324, 'column_c': 546}
    ];

    and you want get the value of the ‘column_c’ where the value of the ‘column_a’ column is 23

    the piece of code to use would be similar to:

    for(var obj in obj_array){
    if(obj_array[obj]['column_a'] == 23 ) return obj_array[obj]['column_c'];
    }

    These are only examples, the code to use will depend of your project, and there is not an unique way to implement it.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘IF and MIN/MAX calculations’ is closed to new replies.