Jump to content

TERR Expression Function - While Loop Not Working


Tyger Guzman 2

Recommended Posts

I have the follow TERR/R script I'm trying to impliment into an expression function.

I get the following Error when trying to use the function on any more than 1 single row :

TIBCO Enterprise Runtime for R returned an error (5)

The expression function 'tenCharFun4' could not be executed.

Error in numberOfDays(as.Date(datestring, "%Y-%m-%d")) : Unexpected length of vector

numberOfDays(as.Date(datestring, "%Y-%m-%d"))

This runs just fine as a DataFunction and also works as an Expression Function (as long as its only one ROW)

numberOfDays

Link to comment
Share on other sites

hi

it would help to have an example dxp.

I tried the data function with made up data and it did not work originally. I used sapply(..) instead and it does not error any longer. But I either get True, or a different error when I send a random numeric sequence - what is the function logic and the expected result

So instead of:

output

Link to comment
Share on other sites

I was able to resolve the issue by removing the while loop and finding the number of days in a month an alternate way.

BUT - I still run into some vector issues. If I have value that should return false in a firstcheckit seems process with the whole vector through other checks.

I've attached an example dxp.

Alternate number of days in month :

numberOfDays

Link to comment
Share on other sites

Hi - could you elaborate on

 

- what the input data represent (seems YYMMDD plus maybe hour and minute)

 

-what do you want to calculate. What does True or False mean

 

It seems quite a complex algorithm so if I understood what you want to calculate I could see if it can be simplified.

 

Thanks

 

Gaia

Link to comment
Share on other sites

It's a validation of identifer string. It first does a regex check to make sure in proper format (this is where the behavior is odd cause if it fails the regex expression then that should end the validation for that record)

 

 

 

But depedning on the number of characters different validations takes place (IE: checking certian characters and even multiplying/adding some characters to esnsure they match others)

 

 

 

So no this validation can not be simplified. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...