...
Code Block |
---|
let intentValue = values["Field_name"]
if (intentValue == "Field_name")
{
this.enableField("Field_name",tID)
this.enableField("Field_name",tID)
this.mandatoryField("Field_name",true,tID)
this.mandatoryField("Field_name",true,tID)
}
else if (intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" )
{
this.disableField("Field_name",tID)
this.disableField("Field_name",tID)
this.changeFormValue("Field_name", " ",tID)
this.changeFormValue("Field_name", " ",tID)
} |
16. Excel View validations and manipulations: Extract ASIN,customID and keywords from Amazon URL’s
Code Block |
---|
|
let intentValuegetUrl = values["Field_nameCompetitor Exact URL"]
iffunction ExtractASIN(intentValueurl){
== "Field_name") { var this.enableField("Field_name",tID)
this.enableField("Field_name",tID)
this.mandatoryField("Field_name",true,tID)
this.mandatoryField("Field_name",true,tID)
}
else if (intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" || intentValue == "Field_value" )
{
this.disableField("Field_name",tID)
this.disableField("Field_name",tID)
this.changeFormValue("Field_name", " ",tID)
this.changeFormValue("Field_name", " ",tIDASINreg = new RegExp(/(?:\/)([A-Z0-9]{10})(?:$|\/|\?)/)
var cMatch = url.match(ASINreg)
if(cMatch == null){
return null
}
return cMatch[1]
}
function ExtractCID(urls){
var CustomCID = new RegExp(/customId=([A-Za-z0-9]+)/)
var cMatch1 = (urls).match(CustomCID)
if(cMatch1 == null){
return null
}
return cMatch1[1]
}
function ExtractKeywords(url) {
const regex = /keywords=([^&]+)/;
const match = url.match(regex);
const keywords = match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
return keywords.replace(/\+/g, ' ');;
}
this.changeFormValue("Comp_ASIN", ExtractASIN(getUrl))
if (ExtractCID(getUrl)== null){
this.changeFormValue("CustomID", "Not available")
}
else{
this.changeFormValue("CustomID", ExtractCID(getUrl))
}
if (ExtractKeywords(getUrl)== null){
this.changeFormValue("Source_Of_Search", "Not available")
}
else {
this.changeFormValue("Source_Of_Search", ExtractKeywords(getUrl))
} |