
I have a flow that reads a document with AI, one of the variables that it extracts is a date and i need to add business days to this date. When i try to add these days treating the date as a date, there's an issue which says 'In function 'addDays', the value provided for date time string '45309' was not valid. The datetime string must match ISO 8601 format.'. So right, date is seen as an int in operations apparently, so i go with that and make a solution for the int case which involves using the function int() on the previous date, but whenever i do that it seems to change to a date because then i get this error 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'. So now that's a date... I'd like to know a way for it to stay int or date. I've tried specifying on every excel action the date format being ISO 8601, and i'm not sure how the number works to show a date, since in the excel document it succesfully shows as a date.
EDIT: Here's the output for each case on the last excel action before i try to add business days:
'Fecha sobre' as an int
'Fecha sobre' as a date
Yey i fixed it apparently, what i did was make a function for both cases in a compose action, which is the following:
if(isInt(body('Update_a_row')?['Fecha sobre']), addDays('1899-12-30', int(body('Update_a_row')?['Fecha sobre']), 'g'), body('Update_a_row')?['Fecha sobre'])So this checks if 'Fecha sobre' value is an int, if it is it makes an operation with that int, if it isn't it just returns the date. Btw i tried doing this but there was an error about invalid parameters in a 'for each' thats like so far from the compose action, so with the aid of Chat GPT i corrected this unknown error. Hope this helps somebody.