Jump to content
  • 0

Another way to search multiple fields for one value


JohnM

Question

Caspio has posted a way to search multiple fields for one value. Here is another way.

In “Search and Report Wizard - Configure Search Fields,” Include the fields and change the Logic of the search so that a match in any of the multiple fields returns a record.

image.png.8023bddcb4f8c305d6df91664c0f51ba.png

Now add into the header of that search form a Virtual Field (here named “correspondent”) and include Javascript in the header that copies the value of the Virtual FIeld into the form elements.

document.addEventListener('DataPageReady', function (event) {
       const whoFrom = document.getElementById('Value10_1');
       const whoTo   = document.getElementById('Value11_1');

       const correspondent = document.getElementById('cbParamVirtual1');
       correspondent.addEventListener('change', setValues);
       
       function setValues(){
           whoTo.value = correspondent.value;
           whoFrom.value = correspondent.value;
       }
});

Then use CSS to hide the non-Virtual fields whose values are being set with the Javascript.

div[class^="cbFormNestedTableContainer cbFormBlock11"] > div[class^="cbFormBlock12"], 
div[class^="cbFormNestedTableContainer cbFormBlock11"] > div[class^="cbFormBlock13"] {
     display:none;
}

In my case searching on the value of the Correspondent field returns record where the From or the To fields match the Correspondent criteria.

image.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...