DFFS Built-in Function Reference – seeking volunteers

Forums Dynamic Forms for SharePoint DFFS Built-in Function Reference – seeking volunteers

This topic contains 3 replies, has 2 voices, and was last updated by  Keith Hudson 5 months ago.

  • Author
    Posts
  • #16591

    Keith Hudson
    Participant

    This is a call for anyone who would like to collaborate on producing a reference showing all the built in functions in DFFS that we can use in our custom JS code. I’m sure Alex could produce one, but I’d like to see if we could start a working group to take that load off Alex and produce at least a draft of such a reference ourselves, then ask Alex to review it/correct it/add to it. I would be glad to host it on a web site if needed, although Alex might be willing to add it somewhere on this site.

    Is anyone interested in having such a reference? Helping build it?

  • #16622

    Alexander Bautz
    Keymaster

    Hi Keith,
    Not much response yet, but I hope more people will post their code examples here – I’m sure it will be of great help for others to have a set of examples / references.

    As you know I’m a bit to busy to be able to write it up myself, but I’ll do my best to help out with any questions.

    Thanks for the initiative,
    Alexander

    PS: I made it sticky.

  • #16633

    Keith Hudson
    Participant

    // get/set field values.
    // NOTE values are read from or written to the input field as strings.
    // On save, they are converted by SP to the right data type
    getFieldValue(‘FIN’)
    setFieldValue(‘FIN’ , ‘valueToSet’)

    • This reply was modified 5 months ago by  Keith Hudson. Reason: improve spacing
  • #16640

    Keith Hudson
    Participant

    //spjs_QueryItems
    //retrieve items from a list
    //takes an object containg the following parameters:
    //listName, query, viewFields
    spjs_QueryItems(argObj)

    example:
    function getMacros(){
    var fieldName = “Title”;
    var fieldType = “Text”;
    var listName = “Foods”;
    var targetString = getFieldValue(“Food”);
    var qty = getFieldValue(“Qty”);
    var res, qb = [], item;
    qb.push(“<Where>”);
    qb.push(“<Eq>”);
    qb.push(“<FieldRef Name='” + fieldName + “‘/><Value Type= ‘” + fieldType + “‘>” + targetString + “</Value>” );
    qb.push(“</Eq>”);
    qb.push(“</Where>”);
    res = spjs_QueryItems({“listName”:listName,”query”:qb.join(“”),”viewFields”:[“PctFat”,”CalTot”,”PctCarb”,”PctProtein”]});
    if(res.count > 0){
    item = res.items[0];
    setFieldValue(“TotCal”,item.CalTot !== null ? item.CalTot*qty: “not set”);
    setFieldValue(“PctFat”,item.PctFat !== null ? item.PctFat*100: “not set”);
    setFieldValue(“PctCarb”,item.PctCarb !== null ? item.PctCarb*100: “not set”);
    setFieldValue(“PctProtein”,item.PctProtein !== null ? item.PctProtein*100: “not set”);
    }
    }

    Forum articles:
    get values from another list/
    vlookup-from-new-on-separate-list

You must be logged in to reply to this topic.