"variable" sorting in report?

navnoob
navnoob Member Posts: 26
Hi all,

This is my situation. I have a customer table with two new field call

customer code, due date

I also have two functions that generate a customer code and a due date base on some customer number. Those two functions are working properly.

When the customer card is run, the two fields (customer code, due date) will display the proper customer code and due date through this:
"Customer Code" := GetCustCode("No.");
"Due Date" := GetDueDate("No.");

In the OnActivateForm and OnAfterGetRecord Trigger

Well, when the customer card is run, the field display the proper data. That's fine. however, the data are not written into the database.

So I change to this.
VALIDATE("Customer Code", GetcustCode("No."));
VALIDATE("Due Date", GetDueDate("No."));

It still doesn't write to the database. So what can I do to make the data write to the database? I try using the CurrForm.UPDATE; but I don't like it because it keeps telling me if I want to modify the record or not.. so that dialog box is annoying.

LAstly, in the report, for the reqfitfield, is it possible to have a field to be a "variable", since I need the report to be sort by Due Date, and the Due Date don't have have value since I couldn't write any value into the Database, is there a way where I can have the user input the date filter and then do some coding such as SETRANGEFILTER so the report would display base on the date filter even if the due date field is empty?

Thanks.

Comments

  • David_Singleton
    David_Singleton Member Posts: 5,479
    This is one of those scary ones, where the answer is really simple, but probably will not solve your problem. Unfortunately too many people get upset if they get the help they really need, instead of just the help they want...

    So the issue is just change your code to:


    "Customer Code" := GetCustCode("No.");
    "Due Date" := GetDueDate("No.");
    modify;
    

    and the database will be updated.

    BUT I really don't think that this is what you really want.

    It might be better if you explain WHAT you want to do rather than HOW you want to do it.
    David Singleton
  • navnoob
    navnoob Member Posts: 26
    hihi,

    i took your advice of using the modify;

    but when i run the card, it don't display the card but instead throw me a dialog box saying:

    "You cannot make any changes in the database until a transaction has been started"

    So i guess i didn't work.

    So basiclly what I want is to store the return value I got from my GetCustCode and return value from my GetDueDate into their field as the user runs the customer card and as they look at all the records in the customer card, my Getcustcode and getcustdate function will do its thing and generate the proper code and display in the item card as well as write the value into the database.

    Thanks.
    Thanks.
  • Savatage
    Savatage Member Posts: 7,142
    edited 2007-01-05
    So basiclly what I want is to store the return value I got from my GetCustCode and return value from my GetDueDate into their field as the user runs the customer card and as they look at all the records in the customer card, my Getcustcode and getcustdate function will do its thing and generate the proper code and display in the item card as well as write the value into the database.
    It might be better if you explain WHAT you want to do rather than HOW you want to do it.

    I don't understand your explaination. Could you be clearer so this can help others in the future. Now Is this a custom card or are you talking about the Customer Card and something happens when they look at an account?

    Note: I read it again & i still don't get it. Do you want a list of due invoices to appear when someone goes into the customer card?
  • David_Singleton
    David_Singleton Member Posts: 5,479
    navnoob wrote:
    hihi,

    i took your advice of using the modify;

    but when i run the card, it don't display the card but instead throw me a dialog box saying:

    "You cannot make any changes in the database until a transaction has been started"

    So i guess i didn't work.

    So basiclly what I want is to store the return value I got from my GetCustCode and return value from my GetDueDate into their field as the user runs the customer card and as they look at all the records in the customer card, my Getcustcode and getcustdate function will do its thing and generate the proper code and display in the item card as well as write the value into the database.

    Thanks.
    Thanks.

    NO this is HOW you want to do it. You are talking here of code and technical details. The WHAT is the important bit. WHAT ARE YOU TRYING TO ACHIEVE?
    David Singleton
  • navnoob
    navnoob Member Posts: 26
    Hihi,

    okay sorry, my English is bad so please bear with me :)

    So my project is that for the customer card, they want two extra field call Customer code field and a due date field

    A Customer code and a due date code is generated base on the salesperson from the commission

    So when the user runs the customer card, they should see their customer code and due date base on the salesperson, so the two additional field should update on the fly if the salesperson code gets change under the commission tab

    Then they want a report to print the customer card record and and one of the require filter field is the Due Date

    So my goal is to do the above.

    Thanks
  • Savatage
    Savatage Member Posts: 7,142
    Just curious what is the due date? due date of what?

    you have a commission card or something? how about creating a flowfield?
  • navnoob
    navnoob Member Posts: 26
    Just curious what is the due date? due date of what?

    you have a commission card or something? how about creating a flowfield?

    Hi Savatage,

    The Due Date is a reminder to let the employee know that they have to start working for the selected customer starting that date.

    The employee wants to call it due date.

    In the customer card, I have a commission tab, and in there I get to select the salesperson and their commission
  • DenSter
    DenSter Member Posts: 8,307
    You need to program whatever you want into the Salesperson Code field validation trigger, and make that Customer Code field not editable. It is A BAD IDEA to program data code in form triggers. If you need that value in other areas, that is too late anyway. Do you want to have the correct value when the salesperson code is entered or when someone just happens to look at the customer record?
  • navnoob
    navnoob Member Posts: 26
    Hi Denster,

    The customer code and due date should display as the customer "scroll" down the customer card

    There is also a condition where a few "selected" individual are allow to modify the customer code by hand.

    I don't even know anymore.. I am confuse, the sales guy and the client have bad communication and i just receive note that the logic flow is not want the client want.... grrrr...

    Well, I have to go fix many stuff....=(

    So thanks for the help all... and hopefully I come back to this problem later..

    Thanks all.