fixed-schedule doesn't work for me
# 🤝help
c
i make sechule who need to add recode to my table every min (for testing) but the the time pass. the add recode doesn't work. i add my code and pic
Copy code
javascript
try {
  let response = await axios.get('https://webtiv.co.il/xml.aspx?clientguid=vDurulmBnbI%3d&agentsguid=cpBomCFCjRA%3d')
  let xmlString = response.data
  let parser = new DOMParser()
  let xmlDoc = parser.parseFromString(xmlString, 'text/xml')

  let propertiesElements = xmlDoc.getElementsByTagName('Properties')
  let picturesElements = xmlDoc.getElementsByTagName('pictures')
  let properties = createXmlRecords(propertiesElements)
  let pictures = createXmlRecords(picturesElements)
  for (let i = 0; i < properties.length; i++) {
    for (let j = 0; j < pictures.length; j++) {
      if (properties[i]['serial'] == pictures[j]['picserial']) {
        await Data4Table.createRecord(createDbrecode(properties[i], pictures[j]['picurl']))
        j = pictures.length
      }
    }
  }

  // Call the async function
  // await createRecords(propertiesElements)
} catch (error) {
  console.error(error)
}

// Define an async function to handle asynchronous creation of records

function createXmlRecords(xmlElements) {
  let elements = []
  for (const prop of Array.from(xmlElements)) {
    let property = {}

    Array.from(prop.childNodes).forEach((node) => {
      if (node.nodeType === 1) {
        property[node.nodeName] = node.textContent
      }
    })

    elements.push(property)
  }
  return elements
}
function createDbrecode(xml, picUrl) {
  return {
    pet: false,
    area: xml['shcuna'],
    city: xml['city'],
    size: parseInt(xml['builtsqmr']),
    image: picUrl,
    isKey: false,
    price: parseInt(xml['priceshekel']),
    rooms: xml['room'],
    arnona: 1000,
  }
}
https://cdn.discordapp.com/attachments/1238182599575212092/1238182599743242550/image.png?ex=663e5ae8&is=663d0968&hm=2101ba6d6887793130989ff41775424e2e2ef220eac46d6ccfa8c0b20d42cfd9& https://cdn.discordapp.com/attachments/1238182599575212092/1238182599961083994/image.png?ex=663e5ae8&is=663d0968&hm=0bee2bd39211968c6a22fe9ab476e83393861e416c826f8ab1f446bd31a1df53&
f
Have you published?
c
yes i publish and this doesn't add to my recode
f
Have you checked the logs of the bot, outside of the studio?
f
Can you check your usage?
You might have used up all of your Incoming messages and events
c
f
So the code works when running it through the emulator, but not when its been published?
c
yes
e
I think this function DOMParser might not be available, just like Blob and fs
@witty-football-93730 could you confirm?
f
What is the point of your code?
c
I trying to parse an xml response from this url and create records based on the data extracted from the xml
f
Weird. Maybe @witty-football-93730 or @famous-jewelry-85388 knows?
7 Views