Announcement

Collapse
No announcement yet.

Need Help re Ajax

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help re Ajax

    Hi

    I'm using Professional version 8.

    My partial database structure is as follows:

    TableA {Field1 (PK), Field2 (Foreign Key [smallint(5) Data Type] related to Primary Key[smallint(5) Data Type], Field3, Field4}
    In scriptcase for field2 weíve turned SELECT on SQL Ė [SELECT FieldA FieldB FROM TableB ORDER BY FieldB]

    TableB {FieldA(PK) [smallint(5) Data Type], FieldB]

    What I want to achieve is that as soon as I enter an amount in field3, a value is calculated into field 4 as per the following formula:
    In Table A Iíve entered a PHP method: {field4} = {field3} / {field2}

    Iíve created a new Ajax onchange Event in TableA on selected field3 and 2clicked both field2 and field4 as parameters to be passed.
    Then Iíve called the above PHP function as method() in the Ajax method_onChange window.

    However when I run the application I get a massive error instead.

    Iím very certain that a big part of this error is because Iíve made reference to field2 in the formula which does not contain my required value because it is merely a relation key. I think I shouldíve used fieldB instead.

    Could anybody help me with guidance on how to use a field from a different table in my formula to correctly achieve my objective? Also, have I made any additional syntactical mistakes (for example should I have used curly brackets {). Likewise did I pass the correct parameters in Ajax to get the correct calculations as above. Please forgive my ignorance but Iím a novice in this (but have much ambiyion to achieve).

    Thanking you in anticipation,

    John

  • #2
    Hi John,

    dealing with field 2 in formula will deal with its value as a primary key, that is ok, and it is what you want as I understood your formula is correct, you don't need the other field from the other table... you should not get error when trying to calculate your field {field4} however, if it is a database field, and you want to fill it by SC, i think you will need a different approach... but, your formula to calculate the field4 is okay if you have the field4 added by SC, not by database.. consider it a virtual field that is calculated in the application, put it on record event, it will be calculated from from the other fields in the same row

    curly brackets { } are ok for fields

    if this is not what you want, add sample project, mentioned db type and add a sql dump, then add also the error, or screenshot of it will be better

    let us see your exact issue

    cheers

    Comment

    Working...
    X