• Resolved klingbeil

    (@klingbeil)


    Hello;
    I pulled data using the API with a php file. I also have the data I capture calculated as JSON in the calculated fieldname field.
    But the problem is that while you can print the result; The value I calculated does not appear in the “calculated fieldname” field.

    How can I solve this problem?

    criterion92 output appears. but it does not appear in the calculated fieldname field that I defined.
    I would be very happy if you could suggest a solution.

    (function () {
    	var criterion92 = '';
        jQuery.ajax({
            url: 'https://www.xxx.com/xx.php',
            dataType: 'json', 
            success: function (response) {
                var criterion92a = response.data;
    
    		criterion92 = PREC(criterion92a * fieldname44 * 7.216,2,true);
                jQuery('#calculation-criterion92').html(criterion92);
    
            },
            error: function (error) {
                console.error('Error fetching data:', error);
            }
        });
    })();
    • This topic was modified 10 months, 2 weeks ago by klingbeil.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    Please include the link to the page that contains the form. I cannot know if the data are read properly, or if the element ID is correct without checking your code in action.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    link

    As an example, I gave the output criterion92 field. I left the area open for you to see.
    The output comes but it doesn’t fill the space.

    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    The issue is simple. Your form 14 does not include any tag with ID calculation-kriter92

    So, the piece of code jQuery('#calculation-kriter92') does not select any element.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    It actually selects it in the code.
    Frankly, I don’t understand exactly what the problem is;

    The code below gives output in the function in the section. but it doesn’t fill the fieldname53 field.

    (function () {
    	var kriter92 = '';
        jQuery.ajax({
            url: 'https://www.xxx.com.tr/xxx/xxx.php',
            dataType: 'json', 
            success: function (response) {
                var kriter92a = response.graltinalis;
    
    		kriter92 = PREC(kriter92a * fieldname44 * 7.216,2,true);
                jQuery('#calculation-kriter92').html(kriter92);
                jQuery('.kriter92-aciklama').html('?evrilen Miktar : ');
                jQuery('.kriter92-sonuc').html(FORMAT(kriter92, { groupingsymbol: ".", decimalsymbol: "," }) + ' TL');
            },
            error: function (error) {
                console.error('Error fetching data:', error);
            }
        });
    })();
    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    The selector #calculation-kriter92 means there is a tag with ID calculation-kriter92 but your form 14 does not includes a tag with that ID.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    How can I solve the problem? I’m a little confused. Have you shared the updated code?
    thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    Please insert an “HTML Content” field in the form, and enter the following tag as its content:

    <div id="calculation-kriter92"></div>

    And your code will display the value of kriter92 in this tag.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    Hello;
    You still don’t understand my problem sir. I already get it as output, it appears in my code above.

    calculation-kriter92

    It comes as output. But this is what I calculated. It does not appear in the fieldname53 field where I made the calculation.
    For this reason, I cannot calculate the data I collected. It just comes as output.

    I tried the div tag you gave and it gives output in the form.

    It’s clear enough. The problem is that no data is received in the fieldname53 field.

    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    You’re reading the values with AJAX, and AJAX works asynchronously. When the server sends the response, the equation thread is not active. So, you have two alternatives: you can use the cffProxy operation (https://cff.dwbooster.com/blog/2019/05/17/third-party-connection-module) or simply, include the following piece of code to assign the field’s value directly after receiving the server response:

    getField(fieldname53|n).setVal(kriter92);

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    Thank you

    • This reply was modified 10 months, 2 weeks ago by klingbeil.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘About the Data Extraction Problem’ is closed to new replies.