Strapi CMS get next or previous entry - rest

i've created CMS with Strapi /MongoDB and REST/.
Is there any way to get next content. I want to display next content details on specific content page.
Or should i customize id field to auto increment field and get content using add one to id field.
Thanks

For previous item you can call get all endpoint with filter with less than actual_ID. And sort it by id and go with size pages 1 and you get first item which is published and exist and is prev. Same for next but with filter with bigger than actaul_ID.

After few tries, I've decided to make id field to auto increment and sent request by adding or subtracting one from id. There were no other solution. If id is one its first content or if the next contents' response is 404 its the last content. This is how i solved this problem. If you have simpler or better solution let me know. Thanks.

Related

Increment Id in Sharepoint

I am trying to increment an Id in a Sharepoint list.
I have tried different settings in the online editor of Sharepoint under "Settings > List Settings > Edit Column > Calculated Value".
Another option I tried was to create a custom add form using InfoPath.
In this custom form, I added a rule on my field contactId. The rule has two actions.
Create a Query to the Contacts table
Set the current Id equal to (the maximum idContacts + 1)
enter image description here
A thirth option I tried is to set a rule under Submit options. That way I thought when I submit my form it will check if idContacts is currently blank. It will Query the Contacts table, set the current idContacts as the (maximum idContacts + 1) and finally submit the data to my table.
enter image description here
Finally When I submit my form it gives a pop up message "Connecting to Server" then it redirects to my list but nothing is added to the list.
Does anyone know what my problem could be. Or does anyone know a proper way to do this. I already lookup up a lot of tutorials and other information but I can not find it.
Thank you in advance!

Getting current item ID in SharePoint Infopath form

Can we get the current item ID value while submitting the data in InfoPath form.
I need to use this and concatenate the ID with other field value. Tired "Max(#ID) + 1" function but it wouldn't solve the problem.
I know it can be done using calculated column or workflow.
It needs to be done using InfoPath form ? Is it possible ?
You already figured it out yourself. Im assuming you are trying to use the ID in naming it.
Create a blank field.
Then add that field to your submission naming concat.
Create a receive data connection (assuming you havent) to that library.
On the Submit rule add the query action to that library and a set field action to set that new blank field with max(ID) + 1. Make sure Submit action is last.
That should do it unless Im missing something as I have used this many times!

Retrieve the newly added comments from Facebook

Giving a PostId i'm trying to retrieve all the comments attached to this post by using the graphApi. Its simple to retrieve the comments for the first time, i just keep following the next link in the paging propertie of the api response.
But to keep this list of comments up to date i need to retrieve the newly added comments. I tried using the cursor After (stored from the last retrieved page) but it's not working as expected, using the parameter since in the query doesn't work either (seems that it is not supported by the endpoints /comments).
Can please someone gives me an alternative solution?
As i said 'since' is not supported by the endpoint '/comments' because the api use cursors for the pagination (next, after and befor fields).
The use of the cursor 'after' will not work neither, because the its value is valide for a short period of time (docs link)
So my solution was to use an ordred query to get the comments
https://graph.facebook.com/v2.6/[post-id]/comments/&filter=stream&order=reverse_chronological
, i save the created_timeof the first comment as last_update_time. Then the next time i execute my code i check for each comment the time when it has been created if it's grater than the last update time i save it
while (comment.created_time > last_update_time):
comments_list.add(comment)
comment = comments.next()
if (len(comments_list)>0):
last_update_time = comments_list[0].created_time

Google Chart - DataTable inside a form

I have a table created with DataTable of Google Chart, which has a column with a drop-down list. In this way the user can set the proper value of a row.
I am working in Python and Flask and I can retrieve the request data correctly. The problem is that the table, given the amount of data, is showed in pages, each one with 20 rows. When I retrieve the request I get only those 20 rows, so I have no way to know what the user set in the other pages.
How can I get the values of all pages?
Moreover, I noticed that when I change page and then I go back, the table forgets the user changes, so I think I should be careful also to this fact.
Finally, I solved the problem by using a dictionary containing all the changes made to the table and updating the html string inside the table to keep the content updated.

How do I determine the portal row number?

How do I determine the portal row number when dragging a document into a container field in FileMaker? Dragging a document into a container field doesn't change focus, so Get(ActivePortalRowNumber) doesn't work.
Well, you could have a second relationship to the same related records sorted by the modification dates of the related records, most recent first. Then the record that had had the document dragged into the container field would appear as the first related record via that relationship, and you could grab an ID field from it.
Alternatively, each related record in the portal could contain an unstored calculation field set to "get(recordnumber)". Within a portal, that will evaluate to the portal row number of the record. Maybe you could use that somehow. Without more information on what you're trying to accomplish, though, it's tough to say.