How do I list/include ALL the data fields (from my database) when I generate a list page on my app? My database record has five data fields/elements: id, class name, class description, date of last class and date next class due. I have successfully created a page on my app that shows all the classes in my database but it only shows the class title in the list. Is there a way to choose all data fields that I would like to display (in the list) or is it only possible to list one data field? Thank you.
Hi, you can show more information by adding corresponding view components for each of the fields that you want to display inside the container that you are repeating. For example, if you are repeating a container that has two paragraphs inside it, you can bind one paragraph to
current.title and the other to
Hi Mari … thank you for the prompt reply. I will give it a try.
One other question please … if I want to derive the number of days between today (current day) and a date in my db record called “datenext” would I use the following formula:
Datetime_difference(“data.RNClasses1.datenext”, “now”), “days”
I’ve tried this and am getting syntax errors:
Invalid syntax: Unexpected string
Value “data.RNClasses1.datanext” is not assignable to text format “date-time”
Value “now” is not assignable to text format “date-time”
My objective is to compare the two dates and if they equal a certain value, then I want to generate some type of warning (maybe an email, text or some other alert) so that the app user knows when a class is coming due for recertification. Once I have the number of days, do I need an “If/then” condition to check it?
I would appreciate any advice and/or feedback and please let me know if I need to post this versus asking for your support via this email. Thank you!
Hi Mari … per your response below, how do I get more than one paragraph inside a container? When I grab a list item from the component library (on left panel) and try to drag it into an existing paragraph, it will only place it above or below the paragraph … not inside of it. I am repeating the container and would like to place 4 additional data fields for display. Thank you.
Hi, Tony. Paragraph components (and Titles) are all separate parts which can’t be “combined” in the sense I think you’re referring to. You can, however, set multiple paragraphs into the same container, stacked – but I think that’s what you were talking about not wanting to do…
On second thought, if you mean to pull multiple data points into the same paragraph, you can get familiar with formulas. I’m not sure if that’s what you desire, but I did something similar just now with a Rich Text paragraph component (that allows you to add bold or italics). Here’s our formula for first pulling the display name (senderDName) and then the question text (Questions1) from our backend.
"**" + repeated.current.senderDName + "**" + ":\u00a0" + repeated.current.Questions1
Side notes: The two-asterisks-between-quotation-marks force bolding on the text between them. The \u00a0 is how we can safely force non-breaking spaces between different units of data.
A simplified form of the same formula which you could use would be:
repeated.current.senderDName + ":\u00a0" + repeated.current.Questions1
The result of the first formula on our platform in the Web Preview (after pulling the respective data points) is:
Thanks for pitching in @Dominik_Greene!
@Tony_Daldoss, the mistake you’re making in the formula is that you should be using
NOW() without any quotation marks, that makes them into a text instead of variable/function reference. Also put the “days” inside the formula, not outside.
Hello, Dominik … thank you very much for your input! I am just new to AppGyver so it may take me a while to digest (and understand) the information that you provided but I will study it and try to apply it to my app. Thanks again … and take care!
Hi Dominik … based on the example formula that you provided, I would appreciate you looking at the sequence below to see if my approach is correct to add the additional db fields to the display. Just not sure of the right steps to follow. Thank you for your time!
Yes, exactly. The cleanest formula for what you want would be like this:
repeated.current.name + repeated.current.classdescription + repeated.current.lastdate + repeated.current.nextdatedue
It is important to note that this would load in all the data side-by-side without spaces. A simulated example would show this as: John SmithClient220.127.116.11.21
(I’m taking a guess on what ‘classdescription’ means in your app, so I’ve noted it as “Client” above.)
- We can use \u00a0 to place spaces between these data points. This formula would look like:
repeated.current.name + "\u00a0" + repeated.current.classdescription + "\u00a0" + repeated.current.lastdate + "\ua00a" + repeated.current.nextdatedue
The simulated example would be:
John Smith Client 1.7.21 2.5.21
You could actually use the above formula directly if it matches your data names (or adapt it to your case). I realize my previous post was more confusing than it had to be. Don’t worry about the asterisks unless you want to bold some of the text.
If we want to get even more complex, we could add some punctuation and static text. These are normal characters typed between two quotation marks to force it to render directly. It does not involve data. Taking the second formula in the above post, I’ll add some quality-improving static text. It might look like:
repeated.current.name + ":\u00a0" + repeated.current.classdescription + ".\u00a0Last date:\u00a0" + repeated.current.lastdate + ";\ua00aNext due date:\u00a0" + repeated.current.nextdatedue
The simulated example would show:
John Smith: Client. Last date: 1.7.21; Next due date: 2.5.21
\u00a0 is just the code equivalent in a formula of a whitespace character – the same thing as pressing the spacebar on your keyboard. And so, it must be placed between two quotation marks to mark an actual space between data in the rendered app. And now, if you look closer at the formula above, everything that is between quotation marks is actually just static text characters, including periods, colons and semicolons, spaces, and even whole words.
The plus sign character (+) could be thought of as saying “and then”.
I hope that helps put it into perspective.
Hi Dominik … sorry for the late reply … I’ve been on the road. Your feedback is excellent … thank you … and you actually read my mind regarding your second post about adding the static text like ‘Last Date’ and ‘Next due date’. This is exactly what I was looking to do and will give it a try.
Hey, @Tony_Daldoss, glad I could help. How’d that work for you so far?
Hi Dominik … just tried the formula and it’s working very well … just as you explained. Thanks again! Now … another question for you please. Is there any type of character/string that would force a line return (carriage return?) so that each field can start on a new line at the left margin? Currently, each entry looks like this:
Class Name: Test Class, Class Description: First class taken, Last Certification: 2020-08-01, Next Certification Due: 2021-08-01
Are there any formula commands similar to “:\u00a0” that could be used to show the info like this:
Class Name: Test Class
Class Description: First class taken
Last Certification: 2020-08-01
Next Certification Due: 2021-08-01
I will appreciate your suggestions/feedback, Dominik!
Dominik … please disregard the reply I sent to you earlier today. I figured out how to code a ‘carriage return’ into the formula. I used “\r\n”.
Another question for you please … I have a page to add new class info including the “Last Certification Date” and the “Next Certification Due Date”. Currently, the user has to manually enter these dates by typing in the numbers in a “yyyy-mm-dd” field. Does AppGyver provide a calendar date picker plugin or canned routine that I can use? Something that would allow the user to pull up a calendar and choose/pick the two dates required? Thank you.
Hey, Tony. Glad that worked for you!
Regarding the date picker… it depends, actually. We’ve actually been putting off figuring this out for our web app off because there’s no real satisfying answer on our side.
1. For a native app (i.e. IOS), there’s a flow function called Pick Date you can download from the Marketplace which, as I understand it, renders a blocking dialog (presumably, a popup) in which a date can be selected and then stored to a variable to be passed on to your backend. This would probably work just fine. However, I have no experience using this function myself.
2. For a website (web app), you can download the Date Picker module from the Component Market. This one’s a bit iffy as I’ve never gotten it to render correctly in our web app – but that was also months ago. They may have since improved it, or maybe it’ll just work now.
3. Finally, if you’re not really liking either option, you could manually place three dropdown primitive components side-by-side into a container and style them as appropriate. You would then (likely, manually) add a list of months, days, and years and bind all three to page variables as suggested by @Mevi in the thread below. The only real problem with this method for us is that we’re not sure how to limit to valid dates – for example, February 30 or 31 is NEVER a valid date.
• On second thought, it’s possible that your backend would be “smart enough” to detect an invalid date when the POST API fires off, thus, feeding back an error message if you script one in. Heh, we might’ve just solved our own problem just by you asking! We’ll give it a shot. Whatever the case, do remember to store it all as DATETIME variables on Appgyver and types/columns in your backend.
Addendum: If you are working on a mobile app, consider visiting the following thread and referring to @Harri_Sarsa’s post (second down) for how to get the Pick Date flow running:
When all is said and done, I have no idea how much this will actually help you. It might be better, in this case, to create a new thread with further inquiries on the date picker matter.
Thank you, Dominik … as always, very good information to study and learn from. I will take a look at all the ideas and links you provided.
I also need to get back to the ‘date compare’ logic I will need to implement. You had provided some info in a prior post regarding this objective. I need to read the “Date Next Certification Due Date” field in the database and if it’s ‘x’ number of days from today’s date/current date, I would like to be able to send an email reminder to the user. He/she will then know that a class certification is coming due. By the way, is there a way to do this without opening the app? Something like a daily/dynamic check of dates (and email send) without the user needing to open the app?
Please advise at your convenience… and thank you!
How are you doing on your side, Tony?
I believe comparing dates and triggering emails could be done with backend logic – but since they’re are so many backends available with different protocols, I wouldn’t know where to start there. I’d suggest asking on the forums for that particular backend. Perhaps, someone there could provide some code or methods to do what you require.
Hi Dominik … thank you for getting back to me … and I hope you are doing well.
I will take your suggestion and submit a post on the forum regarding possible solutions for the date compare logic and email generation.
Have a good weekend!