Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have two tables - Charges and Order Charges. I do a find for all Charges matching the specified Industry and Product. This part is working perfectly, returning 3 records in the Charges found set for the data I'm testing with.

What I can't figure out is how to add a new Order Charges record for each record in the Charges found set. Please see my script below. Thanks in advance for any suggestions on how I can add the new Order Charges records from the Charges found set.

Commit Records/Requests [ No dialog ]

Set Variable [ $OrderID; Value:"gOrderID" ]

New Window [ ]

Go to Layout [ “Masterfile - Charges” (Charge) ]

Enter Find Mode [ ]

Set Field [ Charge::IndustryProduct; Get (ScriptParameter) ]

Perform Find [ ]

# above works, below does not.

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $ChargeID; Value:Charge::ChargeID ]

Set Variable [ $ChargeDescription; Value:OrderCharge::ChargeDescription ]

Set Variable [ $Quantity; Value:OrderCharge::Quantity ]

Set Variable [ $Rate; Value:OrderCharge::Rate ]

Set Variable [ $UnitOfMeasure; Value:OrderCharge::UnitOfMeasure ]

Set Variable [ $BillingFrequency; Value:OrderCharge::BillingFrequency ]

Set Variable [ $BillingMode; Value:OrderCharge::BillingMode ]

Go to Layout [ “OrderChargesTableView” (OrderCharge) ]

New Record/Request

Set Field [ OrderCharge::OrderID; $OrderID ]

Set Field [ OrderCharge::ChargeID; $ChargeID ]

Set Field [ OrderCharge::ChargeDescription; $ChargeDescription ]

Set Field [ OrderCharge::Quantity; $Quantity ]

Set Field [ OrderCharge::Rate; $Rate ]

Set Field [ OrderCharge::UnitOfMeasure; $UnitOfMeasure ]

Set Field [ OrderCharge::BillingFrequency; $BillingFrequency ]

Set Field [ OrderCharge::BillingMode; $BillingMode ]

Commit Records/Requests

Go to Layout [ “Masterfile - Charges” (Charge) ]

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

Posted

So what isn't working?

At a guess you probably need to set the ChargeID to that of the new record, not the old one.

Posted

The script steps after the # comment step do not seem to execute.

The OrderCharges for adding all belong to the same Order and that's why the OrderID doesn't change within the loop. The primary key for OrderCharges is OrderChargeID and it is generated automatically.

Posted

Is there a found set after the Perform Find?

I cannot see anything in the code that looks broken.

Posted

Solved it.

Where I had:

Set Variable [ $OrderID; Value:"gOrderID" ]

it was storing the literal gOrderID, when I really wanted to specify the global field there. Once I did that, it worked fine. (I did find a couple of other problems, but solved those as well.)

I don't think I could have solved it without the feedback from this board telling me that I was on the right track. Many thanks to all.

Hal

This topic is 5738 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.