Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7960459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:45:39+00:00 2026-06-04T04:45:39+00:00

This is an ugly one. I wish I wasn’t having to ask this question,

  • 0

This is an ugly one. I wish I wasn’t having to ask this question, but the project is already built such that we are handling heavy loads of validations in the database. Essentially, I’m trying to build a function that will take two stacks of data, weave them together with an unknown batch of operations or comparators, and produce a long string.

Yes, that was phrased very poorly, so I’m going to give an example. I have a form that can have multiple iterations of itself. For some reason, the system wants to know if the entered start date on any of these forms is equal to the entered end date on any of these forms. Unfortunately, due to the way the system is designed, everything is stored as a string, so I have to format it as a date first, before I can compare. Below is pseudo code, so please don’t correct me on my syntax

Input data:

'logFormValidation("to_date(#) == to_date(^)"
                  , formname.control1name, formname.control2name)'

Now, as I mentioned, there are multiple iterations of this form, and I need to loop build a fully recursive comparison (note: it may not always be typical boolean comparisons, it could be internally called functions as well, so .In or anything like that won’t work.) In the end, I need to get it into a format like below so the validation parser can read it.

OR(to_date(formname.control1name.1) == to_date(formname.control2name.1)
   ,to_date(formname.control1name.2) == to_date(formname.control2name.1)
   ,to_date(formname.control1name.3) == to_date(formname.control2name.1)
   ,to_date(formname.control1name.1) == to_date(formname.control2name.2)
   :
   :
   ,to_date(formname.control1name.n) == to_date(formname.control2name.n))

Yeah, it’s ugly…but given the way our validation parser works, I don’t have much of a choice. Any input on how this might be accomplished? I’m hoping for something more efficient than a double recursive loop, but don’t have any ideas beyond that

Okay, seeing as my question is apparently terribly unclear, I’m going to add some more info. I don’t know what comparison I will be performing on the items, I’m just trying to reformat the data into something useable for ANY given function. If I were to do this outside the database, it’d look something like this. Note: Pseudocode. ‘#’ is the place marker in a function for vals1, ‘^’ is a place marker for vals2.

function dynamicRecursiveValidation(string functionStr, strArray vals1, strArray vals2){
  string finalFunction = "OR("
  foreach(i in vals1){
    foreach(j in vals2){
      finalFunction += functionStr.replace('#', i).replace('^', j) + ",";
    }
  }
  finalFunction.substring(0, finalFunction.length - 1); //to remove last comma
  finalFunction += ")";

  return finalFunction;
}

That is all I’m trying to accomplish. Take any given comparator and two arrays, and create a string that contains every possible combination. Given the substitution characters I listed above, below is a list of possible added operations

# > ^
to_date(#) == to_date(^)
someFunction(#, ^)
# * 2 - 3 <= ^ / 4

All I’m trying to do is produce the string that I will later execute, and I’m trying to do it without having to kill the server in a recursive loop

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:45:41+00:00Added an answer on June 4, 2026 at 4:45 am

    I ended up performing a cross product of the data, and looping through the results. It wasn’t the sort of solution I really wanted, but it worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a rather basic question, but it's one that's bugged me for awhile.
This ugly blue one with one or two buttons, that takes a title and
Before I throw something ugly together I thought this would be a good one
This question falls into the yes - this works, yes - this is ugly,
Mindblock here, but I can't figure out how to make this less ugly: def
I'm trying to clean up this ridonkulously ugly method here, that's crying out for
I don't like this ugly FileChooser layout in Linux. This layout is used by
Here is what I mean: I need to be able to substitute this ugly
I am using this probably ugly javascript to show a text box (in a
This is terribly ugly: psData = [] nsData = [] msData = [] ckData

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.