VTTCue with indefinite end time - webvtt

I am creating a text track with VTTCues, indicating titles for what is happening live. Since the performance is live, the end time isn't known at the time that the cue starts. I've tried the following:
new VTTCue(100, null, 'woot');
This doesn't work. null gets cast to 0.
new VTTCue(100, Infinity, 'woot');
This throws an error, as Infinity is not a non-finite double.
Once the cue is created, later on I will need to update its end time, and add the next cue.
What's the proper way to do this?

Related

Why does this expression work in one spot but not another when using the same data?

I have 2 reports here that are machine schedules (Wrap & Moulder). They were working great, until I tried to add a checkbox to say whether or not the previous step had been marked completed. It worked initially on Wrap Schedule but when I did the exact same thing on Moulder Schedule it is coming out as data type mismatches. In the checkbox I have put the expression:
=IsDate([Previous_Date_Ran])
It works great on Wrap Schedule, but as soon as a Date is entered in the [Previous_Date_Ran] field I am getting data type mismatches. I have narrowed it down to whenever a date is put into that field, which is odd because when it is Null there is no issue. I have made sure already that my other form that supplies this [Previous_Date_Ran] field is inserting =Date() and not =Now() or =Time(). Below will be screenshots of it working on Wrap but erroring on Moulder.
[
Thank you if you have suffered through with me so far, any help would be much appreciated!
For anyone still struggling here is the steps I took to fix this problem:
Firstly, I have the field Date_Ran as a Date/Time, formatted to short date. Another form has an on-dbl-click event where it inserts today's date in the field. Turns out when you use =Date() in VBA is assigns it a default Variant type. For whatever reason I believe this was what caused the error. The second I switched to using =Date$() it inserts today's date as a string and the error has stopped. Good luck!

MS Access Forms Date/Time Entry Trouble

So I have a couple tables that I want to filter on their Date/Time fields. Here's a snapshot of the form controls that I'm experimenting with.
This will report will probably end up run on a monthly basis, and so the filter "Between Forms!Sorting!OldestDate and Forms!Sorting!NewestDate" will normally work fine. However, sometimes it's useful to just run it on a single day, as in the picture, in which case I need the filter to work out to "Between #M/D/YYYY 0:00:00# and #M/D/YYYY 23:59:59#". Setting up the format on the controls to actually record the time as well as the date, however, has not been working out.
I thought, first, maybe the time wasn't displaying bc my text boxes were too small, so I tried adding the bottom text box. The display in the snapshot is what I desire, however, if I click out of the text box the date disappears and only the time is displayed. It also does not display any time at all until I go in and manually add a time.
Is there a way to force the display of both the short date and the long time? Or is there a way to, say, set the default TimeValue for NewestDate to 23:59:59?
Right now the only "solution" I might have is CVDate(CDbl(Forms!Sorting!NewestDate)+0.99999) appearing multiple times in my WHERE clause, which will make things harder to keep track of or catch mistakes in.
I have vba experience, though I've never tried to use it to mask/edit a form parameter as it is passed to a query. I am using Access through MS Office Professional Plus 2019.
First, in your query, specify as parameters:
[Forms]![Sorting]![OldestDate] DateTime,
[Forms]![Sorting]![NewestDate] DateTime;
Then you can filter on:
[YourDateField] >= [Forms]![Sorting]![OldestDate] And [YourDateField] < DateAdd("d", [Forms]![Sorting]![NewestDate])
If [YourDateField] is text, change that to DateTime. If that is not possible (it should be), use:
DateValue([YourDateField])

Intermittent #error on textbox with fairly simple IIF

I've a Customer form with a tab control that holds the details for the specific items that a customer has: Ground Rent, Electricity and Garage. They may hold all 3, just Ground Rent and Electricity, or just a garage. If they don't have an item, the tab is hidden.
The issue only appears on the Garage tab: I intermittently get #ERROR in the amountdue text box. If I close down the customer and re-open them, sometimes it clears itself (with no action performed). Sometimes it doesn't. Sometimes it needs me to reopen a few times before the value shows.
The box concerned is: txtActualAmountDue and the source is the following:
=iif([tenant],[txtNet],[txtGarageCharge])
Tenant is a form data source Boolean (that indicates whether the Ground Rent/Electricity tabs should be shown).
txtNet = [txtGarageCharge]-[txtVAT]
txtVAT = [txtGarageCharge]*([txtVatPercentage]/(1+[txtVatPercentage]))
The next two are locked textboxes to make life easier
txtGarageCharge = DLookup("[GarageCharge]","Variables", criteria that returns the current row of variables for the current date)
txtVatPercentage = DLookup("[GarageVat]","Variables", criteria that returns the current row of variables for the current date)
The only thing else I can think of to mention is that if the customer is not a tenant, then txtNet and txtVAT are hidden. I sometimes get #Type! in txtNet and txtVat too - and obviously I also get the #Error - but not always: sometimes they're valued okay and I still get the #Error. I've commented out the load/current method lines that hides those textboxes to see if it's that, but it's made no difference.
Like I say - it's not like it happens every time: Just occasionally. Could it be to do with the order in which things are being valued/populated on the form? And once it's been populated once (the values will be the same for every customer) then it's okay? And if it's this, how do I force it to value the text boxes in the right order?
It is probably a timing issue, so try avoiding the mid calculations:
txtNet = DLookup("[GarageCharge]/(1+[GarageVat])","Variables", criteria)
txtVat = DLookup("[GarageCharge]/(1+[GarageVat])*[GarageVat]","Variables", criteria)
or, ultimatively:
=IIf([tenant],DLookup("[GarageCharge]/(1+[GarageVat])","Variables", criteria),DLookup("[GarageCharge]","Variables", criteria))

SSRS Iif always true when false part contains expression

I've got a report outputting to an Excel file, with some fields in a database being empty.
I'm trying to filter these null values out using the following Iif expression in a cell:
=Iif(
IsNothing(Fields!START_DATETIME.Value),
0,
Fields!START_DATETIME.Value
)
This doesn't work, I get "#VALUE" in the cells where the data was null, and the time value of the cell where there was data.
If I use the same expression without an expression as the third parameter:
=Iif(
IsNothing(Fields!START_DATETIME.Value),
0,
1
)
I get 1s where there is a date in the table and 0s where there is nothing.
I'm sorry if this is a duplicate, I couldn't find anything that worked for me...
Edit:
I'm using VisualStudio Professional 2013
Update
What I've got for each entry in the database is: a datetime for authorization time, another for start time and another for stopped time. There is always an entry for authorization time, but not always for start and stopped.
I've split the date and time out from the various datetimes into columns like so:
Authorized date
Authorized time
Start time
Stop time
The idea is that if no start and stop time are present, just use the authorized time
The following expressions are put in the Start time column. Sorry, I don't have enough rep to post images or more than 2 links. I've put program output in this album:
http://imgur.com/a/zJSAY
Doing:
=Iif(Fields!START_DATETIME.Value is Nothing,
DateAdd(DateInterval.Day,693594,TimeValue(Fields!AUTH_DATETIME.Value)),
DateAdd(DateInterval.Day,693594,TimeValue(Fields!AUTH_DATETIME.Value))
)
Outputs the authorized time, so that works fine.
However, doing:
=Iif(Fields!START_DATETIME.Value is Nothing,
DateAdd(DateInterval.Day,693594,TimeValue(Fields!AUTH_DATETIME.Value)),
DateAdd(DateInterval.Day,693594,TimeValue(Fields!START_DATETIME.Value))
)
Outputs the start time where there is an entry, and #VALUE! (null or some such) when there isn't anything.
And doing:
=Iif(Fields!START_DATETIME.Value is Nothing,
DateAdd(DateInterval.Day,693594,TimeValue(Fields!START_DATETIME.Value)),
DateAdd(DateInterval.Day,693594,TimeValue(Fields!AUTH_DATETIME.Value))
)
Outputs the authorized time where there is an entry in start time, and #VALUE! when there isn't anything.
I can't figure this out. I understand (1) and (3), but what I need is for (2) to display the correct start time while there is one, and the authorized time when there isn't.
Update 2
It turns out that Iif() evaluates each conditions even if it is not selected, and any error encountered is passed on regardless. See comments to Why isn't my iif statement evaluating true when the condition is correct?
To fix this I did:
=DateAdd(
DateInterval.Day,
693594,
TimeValue(
Iif(
Fields!START_DATETIME.Value is Nothing,
Fields!AUTH_DATETIME.Value,
Fields!START_DATETIME.Value
)
)
)
This seems to work for me, and should have been the common sense way to do this in the first place...
Thanks again for your help guys.
Excel will guess the type of a column based on the first few cells. If there's typical DATETIME values in those, it'll guess the column is a date column, and it will error with "#VALUE! on values that don't match the type, such as "0".
You should ask yourself what you want to display in Excel for NULL values:
If you just want an empty cell, don't use an expression at all. Just Fields!START_DATETIME.Value will render a NULL value as an empty cell.
If you want a "baseline" datetime, make sure to use that instead of "0". Easiest is probably in your query with something like ISNULL(START_DATETIME, GETDATE()).
If you really want a "0", make sure it appears in one of the first few cells by ordering. Excel will see the "0" and not set the column type to date/time.

powerbuilder datawindow validate records

close to 3 months into powerbuilder classic 12.5 and sql server 2008 and am working out well. I am creating a car hire system using car registration_number as the primary key.
i need to capture the car's details and make sure that the registration_number is not available. The code here is not working but that of the capacity works out...
What is wrong with the code? please give another way that works.
if i dont click on the column 'capacity' and click on save, the program goes on and saves the record even when it is an empty field. how to i avoid that.
String car_registration_number
car_registration_number = dw_newvehicle.GetItemString( Row, "registration_number" )
long error_code = 0
string column
column = dwo.name
choose case column
case "registration_number"
if data = car_registration_number THEN
messagebox("validation error", "You cannot available regno")
error_code = 1
end if
case "capacity"
if integer(data) >10 then
messagebox("validation error", "a car's capacity cannot be more than 10...")
error_code = 1
end if
end choose
return error_code
Instead of GetItemString at the top, you would need to do one or two finds in the DataWindow for the registration number in data. If the first find returns 0 you are OK. If it returns the current row, you need to search from row to the last row unless you are on the last row, which you may well be if you are inserting. However, I wouldn't do it that way because it won't work in a multi-user environment. Instead, you should go ahead and insert the row and then if you get a duplicate key error, tell the user the registration number is already in the system. If the user is going to enter a lot of data you could try to SELECT the registration number from the database when the user enters it, but you still have to be able to handle the duplicate key error.
I don't understand what kind of check you are doing here for registration_number : you are getting the current value of the column in the DW into car_registration_number then you are comparing to the value that was modified (the code comes from the itemchanged event ?). Do you expect to enter a value that is different from the current one ?
Also beware of the GetItemString if the type of the column is not a text (as it is called ..._number) as PB may crash, return some null value or silently fail (depending on the PB mood of the moment ;). If you get a null value, your if check will always fail.
If you want to get numerical values, use GetItemNumber instead.
you can set the capacity column to be not null in you database. When saving the DW, you will get an error telling that there is some required value that was not set.
A better idea would be to iterate in the UpdateStart event on the columns that are member of the table primary key and to check if they are set or not.
To write some dynamic code, you can get at runtime the columns from the DW by describing the datawindow.column.count then checking the pk members with #1.key (replace #1 by #2, #3, ...) if the check must be done on that column.