Jump to content

Searches in custom functions?


This topic is 6660 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey,

Is there anyway to do searches or anything that looks like searches in a custom function?

What i want to do is to have a custom function that calculates availability for an article between and startdate and an enddate.

Available(ArticleNumber, StartDate, EndDate)

Right now i do this in a script and therefore have to "push a button" everytime i want to run that script. It's done by going thru the ArticlesOut table where an article is saved with ArticleNumber, StartDate, EndDate and NumberOut.

This probably doesn't make any sense but hopfully someone can answer.

Link to comment
Share on other sites

Via a relationship you can make it automatically "find" something in a portal. But no, there is no actual "Find" in a Custom Function. If you post your file, or try to explain a little bit more, I'm sure we can help you more.

A few things you might want to answer:

1. What criteria is your "find" based on?

2. You said calculates availiablity, what is this based on? Just the start date / end date, or is there more.

Link to comment
Share on other sites

Im sory but i can't post the file.

I'll try to describe it better.

Three tables.

Articles

- ArtNr

- Quantity

Bookings

- BookingID

- BookingStartDate

- BookingEndDate

BookedArticles

- BookingID

- ArtNr

- BookingStatDate

- BookingEndDate

- BookedQuantity

There is a relationship between Bookings and BookedArticles (BookingID = BookingID).

What i do in the file now is that when a user try to book an article (say artnr is ABC and Quantity is 10 of that article) i perform a script that searches thru BookedArticles to find any recrds of ArtNr that are within the dates that the user is trying to book the article. Then i calculate the BookedQuantity and substracts that from Articles:Quantity and have the quantity of articles available.

If i somehow could have a custom function to do this the i could add that do a calculation field and then have the user see this calculation before they push the button and try to add it to a booking.

Link to comment
Share on other sites

This topic is 6660 days old. Please don't post here. Open a new topic instead.

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...

Important Information

By using this site, you agree to our Terms of Use.