List Base URL dynamic

Home Forums vLooup for SharePoint List Base URL dynamic

Viewing 7 reply threads
  • Author
    Posts
    • #11388
      Gianluca Bencivenga
      Participant

        Hi,
        can I set the List Base URL dynamically?
        I have a Project Site Tracker, with sub-sites for any projects, and I need create vLookup where the List Base URL is dynamic.

        For example:
        Project 1 – ID1 sub-site URL: /sites/project/sub-site1/
        Project 2 – ID2 sub-site URL: /sites/project/sub-site2/

        In the URL for sub-sites I put the ID from parent item

      • #11391
        Alexander Bautz
        Keymaster

          Hi,
          I’m not sure I understand what you want to do. You can use “{currentSite}” to set the base url to the current sites base url, and then append to this.

          Are you looking to use a JavaScript variable here?

          Alexander

          • #11393
            Gianluca Bencivenga
            Participant

              Sorry Alexander,
              I did not say that the vlookup is in the parent site.

              Yes, I want use a JavaScript variable here, because I have in the parent list the URL of sub-site and the name of the list in the sub-site is static, only the URL is dynamic

              but I do not know how to do this

              Gianluca

          • #11405
            Gianluca Bencivenga
            Participant

              Hi,
              this is the sample Custom JS….but now I don’t know how to replace value in vLookup blob

              
              
              $( document ).ready(function() {
              var mySite = $("#SPFieldURL a").attr("href");
              console.log(mySite);
              var res = spjs_QueryItems(
              	{
              		"listName":"Attività Progetto",
              		"listBaseUrl":mySite,
              		"query":"<Where><Gt><FieldRef Name='ID' /><Value Type='Text'>0</Value></Gt></Where>",
              		"viewFields":["ID","Title","Author","Created"]
              	}
              );
              $.each(res.items,function(i,item){
              	console.log(item.Title+" was created on "+new Date(item.Created).toLocaleDateString()+" by "+item.Author.split(";#")[1]);
              });
              });
            • #11432
              Alexander Bautz
              Keymaster

                Hi,
                Sorry for the delay. You can put the variable in the custom js like this:

                var vLookupBaseUrlVariable = "/ThePath/To/Your/Site";

                Then use this in the List base URL field in vLookup config:

                {var:vLookupBaseUrlVariable}

                You can chain this together with your static text like this:

                {var:vLookupBaseUrlVariable}/the_rest_of_the_url

                Alexander

              • #11435
                Gianluca Bencivenga
                Participant

                  Hi Alexander,
                  sorry but not working

                  This is the error popup:

                  The value currenty used is:
                  {var:vLookupBaseUrlVariable}

                  Err:
                  Sys.ArgumentException: Sys.ArgumentException: Value does not fall within the expected range.
                  Parameter name: serverRelativeUrlOrFullUrl

                  Gianluca

                  Attachments:
                • #11451
                  Alexander Bautz
                  Keymaster

                    Hi,
                    Which version of the vLookup plugin are you using?

                    This is an undocumented feature and to be honest, I’m not exactly sure which version I added it in, but if you update to the latest version you should be OK.

                    Alexander

                  • #11460
                    Gianluca Bencivenga
                    Participant

                      Hi,
                      I have the latest version,
                      DFFS v4.3.67
                      vLookup plugin backend v2.262
                      vLookup plugin frontend v2.266

                      I tried with the BETA versione, but the result is the same.

                    • #11534
                      Alexander Bautz
                      Keymaster

                        In case anyone else has the same issue: we found the problem, and it will be fixed in the next revision.

                        Alexander

                    Viewing 7 reply threads
                    • You must be logged in to reply to this topic.