Posts by Peter Bradstreet

Show threads by Peter Bradstreet
162 posts found, page 4 of 11

Peter Bradstreet (In thread: Determine if date was removed from date picker)
Just in case anybody has a future use for this, there were a couple of typos in David's code. The correct code should be:

Peter Bradstreet (In thread: Determine if date was removed from date picker)
Perfect thanks. Pete

Peter Bradstreet (In thread: Determine if date was removed from date picker)
A little more info. In DateInput2 there are 3 scenarios for the value of 'datePickerValue'
1. date has not been selected yet: datePickerValue = "undefined"
2. date has been selected: datePickerValue = timestamp for date selected
3. date was selected and then cleared out: datePickerValue = "null"
So it seems that I need to look to see if the value of datePickerValue is either 'undefined' or 'null'. Could you please let me know what the correct syntax is for 2 conditions?
If "a" "==" "a" or "b" "==" "b" Do something here EndIf

Peter Bradstreet (In thread: Determine if date was removed from date picker)
Hi David,

I am using the date picker that is displayed in the DateInput2 example. In my app I need to act conditionally based on whether the due date is set or not.

If you add a button to your sample app and put this code on click: VarIsUndefined "datePickerValue" "Result" AlertBox "[Result]" "primary" You can see that this detects whether a date is selected or not properly. However, if you select a date and then either clear the date manually or press Pick->Clear the 'Result' is 'False' meaning that it thinks that there is still a date selected.

Any idea how I could detect that they have cleared the date ?

Pete

Peter Bradstreet (In thread: Error when testing)
No worries, I was just concerned that it was because of something that I had done to cause the errors. No rush... Pete

Peter Bradstreet (In thread: Error when testing)
Hi, I have an issue with testing using firefox or chrome. The app builds properly in the internal browser and no issues are shown in the console. When I test in Firefox the window doesn't always load fully and there is an error message displayed in AB:.

If I clear the message then the browser typically loads with no further issues. Sometimes though I might get this error up to 10 or 12 times before it is fine. I have also noticed that if I close AB and then restart it, I won't get the error initially the first time that I test in Firefox or Chrome.

Is there something that I should be doing to try and troubleshoot this error? It doesn't stop me from working but it is very inconvenient. Also, while I think of it, I find that whenever I click on an element such as a button in AB in a view in order to access the code behind it, it almost always jumps vertically about 8 pixels and the first thing that I have to do each time is to fix the 'top' value. Am I doing something wrong or is there a preferred way of selecting an element without moving it. Again, not a dealbreaker but it can get frustrating.

Pete

Peter Bradstreet (In thread: Working with javascript timestamps in AB/Firestore)

So I have a chores view which has a report in it and the following code is displaying the results properly due to the use of ".toDate()" which is an Angular function (See https://stackoverflow.com/questions/52247445/how-do-i-convert-a-firestore-date-timestamp-to-a-js-date)

When the user clicks on a report row I take them to an edit view with the various fields populated including the due date if populated. I know that I receive the due date from Firestore as a Firestore timestamp and I need to convert that to a javascript date field. This is done by using the built in function "DateToJSDate", in my case I defined it as 'ReminderDate' then I added 'window.App.RootScope.datePickerValue = window.App.RootScope.ReminderDate;' to the js code and everything works well.

Cheers, Pete

Peter Bradstreet (In thread: Working with javascript timestamps in AB/Firestore)
So it appears that I need to convert the Firestore Timestamp to a JS date format by adding '.toDate' in the pipe.
Due Date: {{Record.DueDate.toDate() | date : "longDate"}}, this code successfully converted it to a js date and then formatted it. Cheers, Pete

Peter Bradstreet (In thread: Working with javascript timestamps in AB/Firestore)
I tried putting this into the report html:
(click to edit)
Chore: [Record.Chore]
Due Date:{{Record.DueDate | date:'longDate' }}
[Record.Details]
When I preview it I still get "Due Date:Timestamp(seconds=1567137600, nanoseconds=0)"

Peter Bradstreet (In thread: Working with javascript timestamps in AB/Firestore)
Hi David,

I am working with a todo list in Firebase/Firestore, each item in the todo list may have a due date field. I am using the new datepicker (from DateInput2 sample) to set each due date in the chore add view.

Firestore stores date data as a javascript timestamp object with two properties: seconds and nanoseconds. If I take a look at the Firestore console I can see each 'DueDate' i.e. '28 August 2019 at 00:00:00 UTC-4', This was just selected as a data in AB but converted itself to a timestamp when pushed to Firestore.

If I use the following code in the report after running my query in the grid view

then the following data is displayed for the DueDate: 'Due Date: Timestamp(seconds=1566878400, nanoseconds=0)' however, I am not interested in time, only the data so I would like to display '28 August 2019' in the chores report (grid view) and also place this date into the date picker on the edit view. Is there a way to convert the timestamp to a date field on retrieval so that I can work with it or is there a better approach?

Thanks! Pete

Peter Bradstreet (In thread: Truncating the text of a Record inside a Report)
That is really cool. Thanks very much!

Peter Bradstreet (In thread: Truncating the text of a Record inside a Report)
Hi,

In my Report I am showing a list of notes including the title and body of the note below in each row. I would like to truncate the body of the note in the grid view if the note is longer than xxx characters. For example, if I set xxx to 16 then "This is a longer sentence that has more than 16 characters" would be truncated to "This is a longer..." but "This is short" would remain as "This is short".

I figured that the easiest solution would be to store the truncated body in a separate field such as note_truncated when adding or editing a record(note) and show 'note_truncated' in the report but show the full 'note' in the edit view.

I was wondering whether you have done anything like this before in AB using existing string functions or would I need to create a custom function?

Thanks, Pete

Peter Bradstreet (In thread: Combining firebase/firestore queries in AB to workaround missing OR functionality in Firestore)
Well I still have a bunch of other objects to deal with now such as to do lists, checklists, maintenance logs etc... so I will keep your words in mind if I run into any other sorting issues on multiple queries with those objects but so far so good.

Thanks as always, Pete


Peter Bradstreet (In thread: Combining firebase/firestore queries in AB to workaround missing OR functionality in Firestore)
Looks like it was as simple as adding "SetVar "[Notes_Report.Order]" "Created" "String"" after the JS block in the view show code.

Peter Bradstreet (In thread: Combining firebase/firestore queries in AB to workaround missing OR functionality in Firestore)
Hi,

It looks like I am going to need to deal with this on the client side. I am now looking at the Report sample that uses a select tool to set the sort order field "ArrayGetItem "[Select1.Items]" "[Select1.ItemIndex]" "[Report1.Order]""

Would it be an option for me to somehow set the Notes_Report.Order to the JSON source object field "Created" after I have retrieved the two queries but before I display the report?

Pete

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.