I’m literally one line, maybe two away from solving this conundrum.
abb is 3-5 characters long, yes I could force them to be all three letters and eliminate the problem, but for dumb reasons, I’m not going to.
Basically I have a table. (its a serial number
[title] [abb]
MSG1000 MSG
MSG1002 MSG
MSG1003 MSG
MS1000 MS
MS1001 MS
MS1002 MS
I need to search abb within title. Which is great, except if I search for MS, I will pick up all the MSG values using .contains .
I need to add a let statement, but i’m not sure how to write it let titlelength = “title”.value.length;
I know I need an if statement in here. Because I need check to see if titlelength = abblength, and if it does get a total count.
import wixData from 'wix-data';
export function dropdown1_change(event) {
let searchabb = $w('#dropdown1').value;
let abblength = $w('#dropdown1').value.length + 4;
const filterValue = searchabb;
const byTitle = wixData.filter().contains("title", filterValue);
$w("#dataset2").setFilter(byTitle)
.then(() => {
let totalCount = $w("#dataset2").getTotalCount() +999;
$w('#input1').value = searchabb + totalCount;
});
}
Hey, thanks for this. I actually ended up working my way around this in a very different way.
Basically I had to create a new column in my table. To designate the owner “MSG”. Then i had the database count the number of “MSG” within the database this forced it to count only exact and MS wouldn’t be counted, and then add 100. then i had it concatenate MS + (count + 100). if anyone needs me to get the code, I can certainly