Get Record ID report_01HR6V09F5G5TAW4AE1QHFTV69
# 🤝help
c
Trying to get the latest records ID from latest insert record, why the records that I get is always 1 and not the latest? I want to update the record in the next node according to latest record
c
maybe try one of these things: - set the limit to 3 and see which records you get. - set ‘latestrecord[1]?id instead of [0] - remove the line at 07 and see the result
c
dons't work :(, and also I want the latest record from the table, it's should be so simple but it's drive me crazy the code should give the latest record and update by the id
I separate the inputs for the user, if he do mistake he can check and update the specific column
f
Hey there Have you tried with the AI Filter?
Also I think if you set the limit to 1 and then search for everything, it will return the latest, but I am not 100% sure here.
c
Hey @fresh-fireman-491 I've tried with AI still no result also with limit 1 no result, why it's so hard to retrieve the latest record @User
s
@cold-jewelry-54343 OrderBy might be broke. I'm not getting expected results, ill check with team. For now you can use something like this:
Copy code
const lastRecord = await WikiPagesTable.findRecords({ limit: 1000 })
workflow.lastRecord = lastRecord[lastRecord.length - 1] || null

console.log(workflow.lastRecord)
Set your limit above what you expect the table to reach so you pull all of the records and then jsut grab the last one.
c
watsup! I think this is the wrong thread but thank you for the answer, will take a look asap
s
Oops. Lol sorry, I tagged wrong person 😛
@careful-fireman-21068
b
@careful-fireman-21068 I tried it here too without any results. OrderBy apparently doesn't run before limit. It would be good to put something like it is done in Mongo { sort: { 'created_at' : -1 } } which does the sort and returns the last Record. For now, do as @straight-wolf-37371 recommend, return the list and filter it with pure javascript for now 😔
c
I moved to Voiceflow, take me 5 min to do this after I broke my pc for 2 days for results on botpress, goodby botpress.
r
A fix is on the way!
🤔 voiceflow doesn't have tables. see you soon!
c
Yes, but they have an API or Webhooks, tnx anyway.
r
We have a much more extensive API: https://botpress.com/docs/api-documentation/ A fully typed Typescript client on top of the API: https://www.npmjs.com/package/@botpress/client A CLI to build and publish integrations: https://botpress.com/docs/developers/cli/ Finally we have a webhook integration: https://app.botpress.cloud/hub/integrations/6d68151a-186e-49c6-a128-940f9a60e673
c
Don't get me wrong; I love the UX UI in Botpress, but these kinds of bugs can shut me down with clients. Botpress is B2B2B for me, and every small mistake can cost a lot. So, your suggestion right now is to work with API?
c
let me test if I can replicate the issue @careful-fireman-21068 I am also in need of querying/updating records and it can indeed be tricky, so know that I share some of your concerns.
c
Thank you! @cold-jewelry-54343, I figure it out with API and webhooks instead of the Botpress tables.
c
thats great to hear! can you share how you approached this so others can learn ?
c
Yes, I helped with this tutorial:

https://www.youtube.com/watch?v=h148bna9VIw&ab_channel=Botpress

. I have to mention that this kind of tutorial is priceless... It seems like Botpress is Webflow, and Voiceflow is Wordpress with Elementor (need to install plugins or use other 3rd party apps for simple tasks like connecting with Whatsapp)... My Process... 1. I created an API CALL to get the records ID from Airtable. 2. retrieve (capture response) the ID as a Variable. 3. At the flow's end, I use a PATCH call to update the record's ID. The idea of working with tables in bot building is a killer feature, but he is super buggy on Botpress, and it seems he is still in the alpha stage.
c
@careful-fireman-21068 thanks for sharing what worked for you. And yes you are right the Tables is a new feature that is most likely feature to change. I was thinking of making suggestions for it but the devs are probably crunching it already as we speak .
33 Views