'MATCH' and 'VLOOKUP' functionality for lists

0

With 'MATCH' the position of an item (ID) in a list can be found on basis of a search string with the match-type options: starts with, exact or contains.

With 'VLOOKUP' a list column value can be read based on list item ID and column name or number.

Comments

1 comment
  • Official comment

     

    Hi Leen,

     

    Just to let you know, the VLOOKUP is already in our backlog, I will add the MATCH too.

    Just to let you know you can do these now using JavaScript CSOM, below I put a VLOOKUP example to get a department manager.

    Regards

    Michal

     

    SPApi.ensureInitialized();
     
    var ctx = SPApi.context;
    var web = SPApi.hostWeb;

    let lookupItem = getValue("Department");

    if (lookupItem.id > 0) {
    let lookupItemId = lookupItem.id;

    var lst = web.get_lists().getByTitle("LookupDepartments");
    var targetListItem = lst.getItemById(lookupItemId);
    ctx.load(targetListItem, 'Title', 'Manager');

    ctx.executeQueryAsync(
       function Success() {
    let pm = targetListItem.get_item('Manager');
    let userObject = { id: pm.get_email(), displayName: pm.get_lookupValue() }
    setValue('DepartmentHead', userObject);
    },
    function Failed(sender,args) {
            alert('Failed: \n' + args.get_message());
        }
    );
    }

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post