October 13, 201411 yr Hi there, can somebody help please, I have two layouts Console & Weekend plan, i created found set on console layout for records whose start date field match a defined date range, returning found set of 37 records, now i would like to match another field on console layout named "Vehicle" to a field on weekend plan layout named Reg.No, if the match then script should add to weekend plan layout TourNr field information from console layout TourNrID field. As at now, i can find the records matching the date range and can not go on from there......i need help for this script to work please and i thai you in advance.
October 26, 201411 yr Hi Miss A I'm not sure if I understand you correctly but if you have a related related record you can just use the related field directly in the original layout - or use use set field in the script to actually make a new entry (not especially recommended). That said maybe you are having problems because you relationship isn't working correctly.
October 27, 201411 yr Author Thanx John - I managed by use of script, because it had to be automated through button, see script below it is working but if you like, please evaluate it, let me know hat i should have used and what not if there is way to better it m just learning. Go to Layout [ “Service Plan” (Service Plan) ] Perform Script [ “Clear SP” ] Set Error Capture [ On ] Go to Layout [ “Remittance_Ordinary” (Remittance_Transport) ] Enter Find Mode [ ] Set Field [ Remittance_Transport::Ledger Accounts; "1010 Service" ] Set Field [ Remittance_Transport::flt__VehicleStatus; "A" ] Set Field [ Remittance_Transport::KM_Reading; "*" ] Set Field [ Remittance_Transport::Reference:; "==###*" ] Perform Find [ ] // If[Get(LastError)] // Go to Layout [ original layout ] // Show Custom Dialog [ Title: "No records found"; Default Button: “OK”, Commit: “Yes” ] // End If Sort Records [ Keep records in sorted order; Specified Sort Order: Remittance_Transport::__ID_Vehicle_Transport; ascending Remittance_Transport::Date_Of_Action; descending ] [ Restore; No dialog ] Go to Record/Request/Page [ First ] Loop #Set Vehicle plate number to match Vehcile_RegNr in Service Plan Set Variable [ $VHR; Value:MiddleWords(Remittance_Transport::Vehicle;2;1) ] Set Variable [ $Veh_Count; Value:GetSummary ( Remittance_Transport::lxt_Vehicle_Summary ; Remittance_Transport::__ID_Vehicle_Transport ) ] # Set Variable [ $NextStart; Value:Get ( RecordNumber ) + $Veh_Count ] Set Variable [ $ADate; Value:Remittance_Transport::Date_Of_Action ] Set Variable [ $KMReading; Value:Remittance_Transport::KM_Reading ] Go to Layout [ “Service Plan” (Service Plan) ] Perform Find [ Specified Find Requests: Find Records; Criteria: Service Plan::lxt_VehicleRegNr: “$VHR” ] [ Restore ] Set Field [ Service Plan::lxd_Last_ServiceDate; $ADAte ] Set Field [ Service Plan::lxn_KMReading; $KMReading ] Go to Layout [ “Remittance_Ordinary” (Remittance_Transport) ] Go to Record/Request/Page [ $NextStart ] [ No dialog ] Exit Loop If [ $NextStart > Get ( FoundCount ) ] End Loop Go to Layout [ “Service Plan” (Service Plan) ] 21 October 2014 11:43:10 Show all records
Create an account or sign in to comment